json.Unmarshal
package main
import (
"encoding/json"
"fmt"
)
func main() {
jsonString := `[{"name":"Alice","age":23},{"name":"Bob","age":32}]`
var people []map[string]interface{}
err := json.Unmarshal([]byte(jsonString), &people)
if err != nil {
panic(err)
}
fmt.Println(people)
}
输出结果:
[map[name:Alice age:23] map[name:Bob age:32]]
[]map[string]interface{}map[string]interface{}json.Unmarshal