Expand description
Incremental JSON (iJSON): path-based operations on JSON data. Port of Go’s pkg/ijson/ijson.go.
iJSON allows expressing JSON updates as a series of commands:
set: Set a value at a pathdel: Delete a value at a pathappend: Append a value to an array at a path
Paths are arrays of string keys and integer indices, e.g.:
["users", 0, "name"] refers to data.users[0].name
Structs§
- Command
- An iJSON command: set, delete, or append.
- SetPath
Opts - Options for set_path operations.
Enums§
- IJson
Error - Error type for iJSON operations.
- Path
Element - Element of a JSON path: either a string key or integer index.
Constants§
- CMD_
APPEND - CMD_DEL
- CMD_SET
- Command type constants.
Functions§
- apply_
command - Apply a single iJSON command to data.
- apply_
commands - Apply a sequence of iJSON commands to data.
- compact_
ijson - Compact iJSON: apply all commands and produce a single set command.
- format_
path - Format a path for display:
$users[0].name - get_
path - Get a value at the specified path within JSON data.
Returns
Noneif the path doesn’t exist (not an error). - parse_
ijson - Parse newline-delimited iJSON commands.
- parse_
simple_ path - Parse a simple dot-separated path string. “users.0.name” → [Key(“users”), Index(0), Key(“name”)]
- path_
to_ 🔒values - Convert Path to JSON values for serialization.
- set_
path - Set a value at the specified path within JSON data. Creates intermediate objects/arrays as needed. Returns the modified data.
- set_
path_ 🔒recursive - value_
type_ 🔒name - Get a human-readable type name for a JSON value.
- values_
to_ 🔒path - Convert JSON values to Path.
Type Aliases§
- Path
- A JSON path is a sequence of string keys and integer indices.
Example:
["users", 0, "name"]→data.users[0].name