Package Functions
Top-level functions provided by the json package, callable directly without creating a Processor instance. Organized by feature category:
Query & Get
Path queries, type-safe getters, safe access, and batch getters.
Key Functions: Get · GetWithContext · GetString · GetInt · GetFloat · GetBool · GetArray · GetObject · GetTyped[T] · SafeGet · GetMultiple
Modify
Functions for setting and merging JSON data.
Key Functions: Set · SetMultiple · SetCreate · SetMultipleCreate · MergeJSON · MergeMany
Delete Operations
Functions for deleting JSON data nodes.
Key Functions: Delete · DeleteClean
Encoding & Output
Serialization, deserialization, and stream encoding/decoding functions.
Key Functions: Marshal · Unmarshal · MarshalIndent · Encode · EncodePretty · EncodeWithConfig · Prettify · Compact · CompactString · Indent · HTMLEscape · NewEncoder · NewDecoder · EncodeBatch · EncodeFields · EncodeStream · SaveToWriter
Parse & Validate
Functions for parsing JSON into target objects, parsing via Processor instances, and JSON validity / JSON 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
JSONL (JSON Lines) parsing, streaming reads, conversion, and writer functions.
Key Functions: ParseJSONL · ToJSONL · ToJSONLString · StreamLinesInto[T] · NewJSONLWriter
File I/O
File read/write and streaming I/O functions.
Key Functions: LoadFromFile · LoadFromReader · SaveToFile · MarshalToFile · UnmarshalFromFile · SaveToWriter
Iteration Methods
Iteration functions for traversing JSON arrays, objects, nested structures, and files.
Key Functions: Foreach · ForeachWithPath · ForeachNested · ForeachReturn · ForeachWithError · ForeachNestedWithError · ForeachWithPathAndIterator · ForeachWithPathAndControl · ForeachFile · ForeachFileWithPath · ForeachFileChunked · ForeachFileNested
File Iteration
File stream iteration guide and practices (see Iteration Methods for the package-level ForeachFile* API reference).
Key Functions: ForeachFile · ForeachFileWithPath · ForeachFileChunked · ForeachFileNested
Helper Utilities
Type conversion, comparison, cache management, error handling, and other utility functions.
Key Functions: CompareJSON · MergeJSON · MergeMany · ClearCache · GetStats · GetHealthStatus · SetGlobalProcessor · ShutdownGlobalProcessor · SafeError · RedactedPath · WarmupCache
Quick Navigation
| Use Case | Recommended Function | Documentation |
|---|---|---|
| Get single value | GetString, GetInt, GetFloat, GetBool | Query & Get |
| Get any type | Get, GetTyped[T] | Query & Get |
| Get with 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 | Modify |
| Delete 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 | Print Functions |
| Batch encoding | EncodeBatch, EncodeFields, EncodeStream | Batch Encoding · Processor Output |
| Batch operations | ProcessBatch | Batch Operations |
| Validate | Valid | Parse & Validate |
| JSON Schema validation | ValidateSchema | Parse & Validate |
| File read/write | LoadFromFile, SaveToFile | File I/O |
| Iterate traversal | Foreach, ForeachWithPath, ForeachNested | Iteration Methods |
| File iteration | ForeachFile, ForeachFileChunked | Iteration Methods |
| JSONL processing | ParseJSONL, ToJSONL | JSONL |
| Compare | CompareJSON | Helper Utilities |
| Merge | MergeJSON, MergeMany | Modify |
| Type conversion | AccessResult type conversion methods | Helper Utilities |
| Error handling | JsonsError, errors.Is | Constants & Errors |
Related
- Processor - Processor methods
- Config - Configuration options
- Constants & Errors - Error types
- Interface Definitions - Extension interfaces
- Path Expression Syntax - Path syntax in detail