Package Functions
Top-level functions of the json package, callable directly without creating a Processor instance. Grouped by feature:
Query & Get
Path queries, type-safe gets, safe gets, and batch get functions.
Key functions: Get · GetWithContext · GetString · GetInt · GetFloat · GetBool · GetArray · GetObject · GetTyped[T] · SafeGet · GetMultiple
Modification Operations
Functions for setting and merging JSON data.
Key functions: Set · SetMultiple · SetCreate · SetMultipleCreate · MergeJSON · MergeMany
Delete Operations
Functions for deleting nodes of JSON data.
Key functions: Delete · DeleteClean
Encoding Output
Serialization, deserialization, and streaming encode/decode functions.
Key functions: Marshal · Unmarshal · MarshalIndent · Encode · EncodePretty · EncodeWithConfig (deprecated) · Prettify · Compact · CompactString · Indent · HTMLEscape · NewEncoder · NewDecoder · EncodeBatch · EncodeFields · EncodeStream · SaveToWriter
Parse & Validate
Functions for parsing JSON into target objects, Processor-instance parsing, and JSON validity/Schema validation.
Key functions: Parse · ParseAny · Processor.Parse · Processor.ParseAny · Valid · ValidWithConfig · ValidateSchema
Batch Operations
Functions for batch-processing multiple JSON operations (get/set/delete/validate).
Key functions: ProcessBatch · BatchOperation · BatchResult
JSONL
Functions for JSONL (JSON Lines) parsing, streaming reads, conversion, and writing.
Key functions: ParseJSONL · ToJSONL · ToJSONLString · StreamLinesInto[T] · NewJSONLWriter
File I/O
File reading/writing and streaming I/O functions.
Key functions: LoadFromFile · LoadFromReader · SaveToFile · MarshalToFile · UnmarshalFromFile · SaveToWriter
Iteration Methods
Iteration functions over JSON arrays, objects, nested structures, and files.
Key functions: Foreach · ForeachWithPath · ForeachNested · ForeachReturn · ForeachWithError · ForeachNestedWithError · ForeachWithPathAndIterator · ForeachWithPathAndControl · ForeachFile · ForeachFileWithPath · ForeachFileChunked · ForeachFileNested
File Iteration
Guides and practices for streaming file iteration scenarios (API reference for the package-level ForeachFile* functions is in Iteration Methods).
Key functions: ForeachFile · ForeachFileWithPath · ForeachFileChunked · ForeachFileNested
Utility Functions
Utility functions for type conversion, comparison, cache management, error handling, and more.
Key functions: CompareJSON · MergeJSON · MergeMany · ClearCache · GetStats · GetHealthStatus · SetGlobalProcessor · ShutdownGlobalProcessor · SafeError · RedactedPath · WarmupCache
Quick Navigation
| Purpose | Recommended functions | Docs |
|---|---|---|
| Get a single value | GetString, GetInt, GetFloat, GetBool | Query & Get |
| Get any type | Get, GetTyped[T] | Query & Get |
| Get with a default | GetString(data, path, "default") | Query & Get |
| Generic get | GetTyped[T](data, path, defaultValue...) | Query & Get |
| Batch get | GetMultiple | Query & Get |
| Modify JSON | Set, SetCreate | Modification Operations |
| Delete from JSON | Delete, DeleteClean | Delete Operations |
| Serialize | Marshal, Encode | Encoding Output |
| Deserialize | Unmarshal, Parse | Encoding Output · Parse & Validate |
| Format | Prettify, CompactString, Processor.Compact | Encoding Output |
| Print output | Encode + fmt.Println, EncodePretty | Formatted Output |
| Batch encoding | EncodeBatch, EncodeFields, EncodeStream | Batch Encoding · Processor Output |
| Batch operations | ProcessBatch | Batch Operations |
| Cache warm-up | WarmupCache | Batch Operations |
| Validate | Valid | Parse & Validate |
| JSON Schema validation | ValidateSchema | Parse & Validate |
| Schema defaults | DefaultSchema, DefaultSchemaConfig | Schema Validation |
| File read/write | LoadFromFile, SaveToFile | File I/O |
| File read/write (structs) | MarshalToFile, UnmarshalFromFile | File I/O |
| Streaming I/O | LoadFromReader, SaveToWriter | File I/O |
| Iterate | Foreach, ForeachWithPath, ForeachNested | Iteration Methods |
| File iteration | ForeachFile, ForeachFileChunked | Iteration Methods |
| JSONL processing | ParseJSONL, ToJSONL | JSONL |
| JSONL streaming | StreamJSONL, StreamLinesInto[T], FirstJSONL | JSONL |
| Compare | CompareJSON | Utility Functions |
| Merge | MergeJSON, MergeMany | Modification Operations |
| Type conversion | AccessResult type conversion methods | Utility Functions |
| Error handling | JsonsError, errors.Is | Constants and Errors |
See Also
- Processor - Processor methods
- Config - Configuration options
- Constants and Errors - Error types
- Interface Definitions - Extension interfaces
- Path Expression Syntax - Path syntax in detail