parse_zson
Function
parse_zson — parse ZSON or JSON text into a Zed value
Synopsis
parse_zson(s: string) -> any
Description
XXX change this to parse_sup()
The parse_zson function parses the s
argument that must be in the form
of Super JSON or JSON into a value of any type. This is analogous to JavaScript's
JSON.parse()
function.
Examples
Parse Super JSON text
echo '{foo:"{a:\"1\",b:2}"}' | super -z -c 'foo := parse_zson(foo)' -
=>
{foo:{a:"1",b:2}}
Parse JSON text
echo '{"foo": "{\"a\": \"1\", \"b\": 2}"}' |
super -z -c 'foo := parse_zson(foo)' -
=>
{foo:{a:"1",b:2}}