Skip to content

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 CaseRecommended FunctionDocumentation
Get single valueGetString, GetInt, GetFloat, GetBoolQuery & Get
Get any typeGet, GetTyped[T]Query & Get
Get with defaultGetString(data, path, "default")Query & Get
Generic getGetTyped[T](data, path, defaultValue...)Query & Get
Batch getGetMultipleQuery & Get
Modify JSONSet, SetCreateModify
Delete JSONDelete, DeleteCleanDelete Operations
SerializeMarshal, EncodeEncoding & Output
DeserializeUnmarshal, ParseEncoding & Output · Parse & Validate
FormatPrettify, CompactString, Processor.CompactEncoding & Output
Print outputEncode + fmt.Println, EncodePrettyPrint Functions
Batch encodingEncodeBatch, EncodeFields, EncodeStreamBatch Encoding · Processor Output
Batch operationsProcessBatchBatch Operations
ValidateValidParse & Validate
JSON Schema validationValidateSchemaParse & Validate
File read/writeLoadFromFile, SaveToFileFile I/O
Iterate traversalForeach, ForeachWithPath, ForeachNestedIteration Methods
File iterationForeachFile, ForeachFileChunkedIteration Methods
JSONL processingParseJSONL, ToJSONLJSONL
CompareCompareJSONHelper Utilities
MergeMergeJSON, MergeManyModify
Type conversionAccessResult type conversion methodsHelper Utilities
Error handlingJsonsError, errors.IsConstants & Errors