Skip to content

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 ​

PurposeRecommended functionsDocs
Get a single valueGetString, GetInt, GetFloat, GetBoolQuery & Get
Get any typeGet, GetTyped[T]Query & Get
Get with a defaultGetString(data, path, "default")Query & Get
Generic getGetTyped[T](data, path, defaultValue...)Query & Get
Batch getGetMultipleQuery & Get
Modify JSONSet, SetCreateModification Operations
Delete from JSONDelete, DeleteCleanDelete Operations
SerializeMarshal, EncodeEncoding Output
DeserializeUnmarshal, ParseEncoding Output · Parse & Validate
FormatPrettify, CompactString, Processor.CompactEncoding Output
Print outputEncode + fmt.Println, EncodePrettyFormatted Output
Batch encodingEncodeBatch, EncodeFields, EncodeStreamBatch Encoding · Processor Output
Batch operationsProcessBatchBatch Operations
Cache warm-upWarmupCacheBatch Operations
ValidateValidParse & Validate
JSON Schema validationValidateSchemaParse & Validate
Schema defaultsDefaultSchema, DefaultSchemaConfigSchema Validation
File read/writeLoadFromFile, SaveToFileFile I/O
File read/write (structs)MarshalToFile, UnmarshalFromFileFile I/O
Streaming I/OLoadFromReader, SaveToWriterFile I/O
IterateForeach, ForeachWithPath, ForeachNestedIteration Methods
File iterationForeachFile, ForeachFileChunkedIteration Methods
JSONL processingParseJSONL, ToJSONLJSONL
JSONL streamingStreamJSONL, StreamLinesInto[T], FirstJSONLJSONL
CompareCompareJSONUtility Functions
MergeMergeJSON, MergeManyModification Operations
Type conversionAccessResult type conversion methodsUtility Functions
Error handlingJsonsError, errors.IsConstants and Errors

See Also ​