Go JSON Handling
Handle JSON encoding and decoding in Go with proper struct tags, custom marshalers, and performance tuning.
Usage
Describe your JSON handling needs and get idiomatic Go solutions.
Examples
- "How do I handle optional JSON fields in Go?"
- "Write a custom JSON marshaler for my time format"
- "Stream-parse a large JSON file without loading it all into memory"
Guidelines
- Use struct tags for field mapping and omitempty
- Show json.Decoder for streaming large payloads
- Cover custom MarshalJSON and UnmarshalJSON implementations
- Explain handling of unknown fields and strict parsing
- Include performance comparison with sonic or jsoniter