Skip to main content

Module json_path

Module json_path 

Source
Expand description

Minimal dotted/indexed path language for JSONL field extraction.

Grammar:

path    := segment+
segment := ('.' ident) | ('[' digits ']') | ('[' quoted ']')
ident   := [A-Za-z_][A-Za-z0-9_]*
quoted  := '"' ( [^"\\] | '\\' ( '"' | '\\' ) )* '"'

Dotted identifiers cover the common JSONL shape (.msg, .steps[0].text). For keys that can’t be expressed as a bare identifier — hyphens, dots, spaces, unicode — use the bracketed-string form: .["user-id"], ["weird key"], or .["日本語"]. Only \" and \\ are recognized as escapes inside the quoted form; anything else is still on the no-wildcards, no-filters side of scope for --json.

Enums§

Segment

Functions§

extract
Walk a JSON Value along the given path. Returns None if any segment misses (wrong type, missing key, out-of-bounds index).
parse_path
Parse a dotted/indexed path expression into a list of segments.