hello 各位大佬,我在将json解析成结构体的过程中出现了问题
import (
"fmt"
jsoniter "github.com/json-iterator/go"
)
type Car struct {
Other []byte json:"other"
}
func MyJson() {
j := {"other": {"a":[1,2]}}
json := jsoniter.ConfigCompatibleWithStandardLibrary
obj := Car{}
err := json.Unmarshal([]byte(j), &obj)
if err != nil {
fmt.Println(err.Error())
} else {
fmt.Println(obj)
}
}
报错”main.Car.Other: base64Codec: invalid input, error found in #10 byte of ...|{"other": {"a":[1,2]|..., bigger context ...|{"other": {"a":[1,2]}}|...“
还劳烦哪位大佬给解答一下
Go从字符串解析出结构体,是需要写明所有结构体结构的。