Remove go-json

This commit is contained in:
世界 2022-07-26 13:53:25 +08:00
parent 75508bccb5
commit 0347a7c038
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
10 changed files with 14 additions and 40 deletions

View file

@ -49,7 +49,7 @@ func (m *JSONObject) UnmarshalJSON(content []byte) error {
}
err = m.decodeJSON(decoder)
if err != nil {
return err
return E.Cause(err, "decode json object content")
}
objectEnd, err := decoder.Token()
if err != nil {
@ -63,14 +63,15 @@ func (m *JSONObject) UnmarshalJSON(content []byte) error {
func (m *JSONObject) decodeJSON(decoder *json.Decoder) error {
for decoder.More() {
var entryKey string
err := decoder.Decode(&entryKey)
keyToken, err := decoder.Token()
if err != nil {
return err
}
entryKey = keyToken.(string)
var entryValue any
entryValue, err = decodeJSON(decoder)
if err != nil {
return err
return E.Cause(err, "decode value for ", entryKey)
}
m.Put(entryKey, entryValue)
}