JSON.GET
Since 1.1.0JSON
Syntax
JSON.GET key [INDENT indent] [NEWLINE newline] [SPACE space] [path ...]Returns values from the JSON document at key, as JSON text.
- No path: the whole document.
- One path: a JSONPath gives a JSON array of its matches; a legacy path gives the first match.
- Several paths: a JSON object with one member per path.
INDENT, NEWLINE and SPACE set the strings used to lay out the text.
Reply
- JSON text, as a bulk string.
nilif the key does not exist.
Examples
> JSON.SET d $ '{"name":"Ada","age":36,"addr":{"city":"London"}}'
OK
> JSON.GET d $.name
"[\"Ada\"]"
> JSON.GET d .name
"\"Ada\""
> JSON.GET d $.name $.age
"{\"$.name\":[\"Ada\"],\"$.age\":[36]}"
> JSON.GET d $..city
"[\"London\"]"