Skip to content

mooncake query

Read a JSON/YAML file and extract a value by dotted path

Description

Read a JSON or YAML file and print the value at the given dotted path.

Path syntax matches read.json / read.yaml (spec-38): dotted keys (a.b.c) and bracketed integer indices (a[0], a.b[3].c). Scalars print raw; objects and arrays print as compact JSON unless --pretty is set.

Exit codes: 0 path resolved, value printed 1 path did not match (file parsed, key absent) 2 file unreadable, oversize, or parse error

Flags

Flag Type Default Description
--as string - Force format: json
--pretty bool false Pretty-print structured output (2-space indent)
--max-bytes int64 4194304 Refuse to load files larger than this size in bytes