Releases: goccy/go-json
Releases · goccy/go-json
0.7.0
Support context for MarshalJSON and UnmarshalJSON ( #248 )
- json.MarshalContext(context.Context, interface{}, ...json.EncodeOption) ([]byte, error)
- json.NewEncoder(io.Writer).EncodeContext(context.Context, interface{}, ...json.EncodeOption) error
- json.UnmarshalContext(context.Context, []byte, interface{}, ...json.DecodeOption) error
- json.NewDecoder(io.Reader).DecodeContext(context.Context, interface{}) error
type MarshalerContext interface {
MarshalJSON(context.Context) ([]byte, error)
}
type UnmarshalerContext interface {
UnmarshalJSON(context.Context, []byte) error
}
Add DecodeFieldPriorityFirstWin option ( #242 )
In the default behavior, go-json, like encoding/json, will reflect the result of the last evaluation when a field with the same name exists. I've added new options to allow you to change this behavior. json.DecodeFieldPriorityFirstWin
option reflects the result of the first evaluation if a field with the same name exists. This behavior has a performance advantage as it allows the subsequent strings to be skipped if all fields have been evaluated.
Fix encoder
- Fix indent number contains recursive type ( #249 )
- Fix encoding of using empty interface as map key ( #244 )
Fix decoder
- Fix decoding fields containing escaped characters ( #237 )
Refactor
0.6.1
0.6.0
Support Colorize option for encoding (#233)
b, err := json.MarshalWithOption(v, json.Colorize(json.DefaultColorScheme))
if err != nil {
...
}
fmt.Println(string(b)) // print colored json
Refactor
0.5.1
0.5.0
0.4.14
Benchmark
Fix decoder
- Fix decoding of slice with unmarshal json type ( #198 )
- Fix decoding of null value for interface type that does not implement Unmarshaler ( #205 )
- Fix decoding of null value to []byte by json.Unmarshal ( #206 )
- Fix decoding of backslash char at the end of string ( #207 )
- Fix stream decoder for null/true/false value ( #208 )
- Fix stream decoder for slow reader ( #211 )
Performance
- If cap of slice is enough, reuse slice data for compatibility with encoding/json ( #200 )