Data Tree
Fold, filter and edit JSON or YAML
Filter paths
Sample {"items": [{"name": "a"}, {"name": "b"}], "x-id": 7}
Steps
.key- key
.itemsgives[{"name": "a"}, {"name": "b"}]."key"- quoted key
."x-id"gives7.["key"]- bracketed key
.["x-id"]gives7.[n]- index, zero-based
.items[1].namegives"b".[-n]- index from the end
.items[-1].namegives"b".[]- all items or values
.items[].namegives"a", "b"
Paths
.- the whole document
.gives{"items": [{"name": "a"}, {"name": "b"}], "x-id": 7}p.q- chained
.items[0].namegives"a"p, q- both
."x-id", .items[0].namegives7, "a"
Missing keys and indexes select nothing. Paths only; no jq functions or operators. jq manual.
Split
JSON