[KongchangAI]
ProductGo JSON 标准库

encoding/json

The core package in the Go standard library for JSON encoding and decoding. It provides the Marshal and Unmarshal functions and relies on reflection to map structs to and from JSON.

Timeline (last 90 days)

Nov 5

Go's encoding/json package has existed in the standard library since Go 1.0.

Unverified50%
Nov 5

The core APIs of encoding/json are the two functions Marshal and Unmarshal, which work with struct tags to accomplish field mapping.

Unverified50%
Nov 5

encoding/json relies on reflection to parse type information at runtime, resulting in significant reflection overhead when processing large-scale data.

Unverified50%
Nov 5

In encoding/json, custom serialization can only be done by implementing the json.Marshaler/json.Unmarshaler interfaces, with relatively coarse granularity.

Unverified50%
Oct 11

The Go standard library encoding/json's DisallowUnknownFields() is a strict-mode option that causes decoding to return an error rather than silently ignoring fields when the JSON input contains fields not defined in the target struct.

Unverified50%
Oct 11

The Go standard decoder by default consumes only the first complete JSON value without reporting an error; a second decode pass is needed to catch trailing JSON values, and if any value can be decoded from the remaining bytes, it is treated as a format violation.

Unverified50%

All Facts (6)

Source Articles