Documentation
¶
Overview ¶
ABOUTME: JSON manipulation utilities with schema support and streaming. ABOUTME: Enhanced JSON operations including merging, patching, and validation. Package json provides enhanced JSON manipulation utilities beyond the standard library. It includes schema-aware operations, streaming support, JSON merging and patching, and integration with the schema validation system for type-safe JSON handling.
Utilities include:
- Schema-based JSON validation
- JSON merging and patching
- Streaming JSON processing
- Pretty printing and formatting
- JSON pointer operations
Package json provides an optimized JSON implementation with multiple backends
Index ¶
- func Get(data []byte, path ...interface{}) jsoniter.Any
- func Marshal(v interface{}) ([]byte, error)
- func MarshalIndent(v interface{}, prefix, indent string) ([]byte, error)
- func MarshalIndentWithBuffer(v interface{}, buf *bytes.Buffer, prefix, indent string) error
- func MarshalSchemaFast(schema *schemaDomain.Schema) ([]byte, error)
- func MarshalSchemaIndent(schema *schemaDomain.Schema) ([]byte, error)
- func MarshalSchemaToString(schema *schemaDomain.Schema) (string, error)
- func MarshalToString(v interface{}) (string, error)
- func MarshalWithBuffer(v interface{}, buf *bytes.Buffer) error
- func NewDecoder(r io.Reader) *jsoniter.Decoder
- func NewEncoder(w io.Writer) *jsoniter.Encoder
- func Unmarshal(data []byte, v interface{}) error
- func UnmarshalFromString(data string, v interface{}) error
- func Valid(data []byte) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get searches a path in json object and returns the JsonIter's Any object. Any is a data type that can be used to represent any JSON value with lazy parsing.
func Marshal ¶
Marshal marshals the interface into a JSON byte array. It's a drop-in replacement for encoding/json.Marshal with better performance.
func MarshalIndent ¶
MarshalIndent marshals the interface into a JSON byte array with indentation. It's a drop-in replacement for encoding/json.MarshalIndent with better performance.
func MarshalIndentWithBuffer ¶
MarshalIndentWithBuffer is an optimized version of MarshalIndent that reuses a provided buffer to minimize allocations. The buffer will be reset and used for the output.
func MarshalSchemaFast ¶
func MarshalSchemaFast(schema *schemaDomain.Schema) ([]byte, error)
MarshalSchemaFast marshals a schema to JSON without indentation, using a pooled buffer This is the fastest option for schema serialization when indentation is not needed
func MarshalSchemaIndent ¶
func MarshalSchemaIndent(schema *schemaDomain.Schema) ([]byte, error)
MarshalSchemaIndent marshals a schema to JSON with indentation, using a pooled buffer This is specifically optimized for the schema domain model and reduces allocations
func MarshalSchemaToString ¶
func MarshalSchemaToString(schema *schemaDomain.Schema) (string, error)
MarshalSchemaToString marshals a schema to a JSON string with indentation This is convenience function for contexts where a string is preferred
func MarshalToString ¶
MarshalToString marshals the interface into a JSON string. This is more efficient than Marshal followed by string conversion.
func MarshalWithBuffer ¶
MarshalWithBuffer is an optimized version of Marshal that reuses a provided buffer to minimize allocations. The buffer will be reset and used for the output.
func NewDecoder ¶
NewDecoder returns a new decoder that reads from r.
func NewEncoder ¶
NewEncoder returns a new encoder that writes to w.
func Unmarshal ¶
Unmarshal parses the JSON-encoded data and stores the result in the value pointed to by v. It's a drop-in replacement for encoding/json.Unmarshal with better performance.
func UnmarshalFromString ¶
UnmarshalFromString parses the JSON-encoded string and stores the result in the value pointed to by v. This is more efficient than string to bytes conversion followed by Unmarshal.
Types ¶
This section is empty.