API Reference
json-iterator/go
A high-performance JSON parser and serializer for Go that is a drop-in replacement for encoding/json.
Official Documentation ↗CompatibilityThis documentation covers version
v1.1. Check the official docs for the latest API surface.Installation
go
go get github.com/json-iterator/goMethods
No methods match this filter.
jsoniter generates optimized code paths and offers a config compatible with the standard library.
Key Features
- Drop-in replacement for encoding/json
- Streaming and iterator-style decoding
- Configurable behavior and extra extensions
Usage Notes
Pin a version and check the official docs for the API surface you depend on before upgrading.
API reference evidence
Fetched from official sources on 2026-11-08T17:28:00+08:00 via WebFetch https://raw.githubusercontent.com/json-iterator/go/v1.1.12/config.go(pkg.go.dev 页抓取截断后改用官方仓库源码).
jsoniter.ConfigCompatibleWithStandardLibrary→ signature from https://raw.githubusercontent.com/json-iterator/go/v1.1.12/config.go; official text: “// ConfigCompatibleWithStandardLibrary tries to be 100% compatible with standard library behavior var ConfigCompatibleWithStandardLibrary = Config{ EscapeHTML: true, SortMapKeys: true, ValidateJsonRawMessage: true, }.Fro”jsoniter.Marshal→ signature from https://raw.githubusercontent.com/json-iterator/go/v1.1.12/config.go; official text: “Marshal(v interface{}) ([]byte, error)”jsoniter.Unmarshal→ signature from https://raw.githubusercontent.com/json-iterator/go/v1.1.12/config.go; official text: “Unmarshal(data []byte, v interface{}) error”
FAQ
- How do I keep standard behavior?
- Use ConfigCompatibleWithStandardLibrary; other configs trade compatibility for speed or features.
- Is it always faster?
- Usually for hot paths with many small objects, but measure; the standard library has improved and may suffice.
- Does it handle streaming?
- Yes. jsoniter.NewDecoder and jsoniter.NewEncoder provide streaming equivalents to the standard API.
Report a problem with this API docOpens a pre-filled issue on GitHub.