Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Function

parse_sup — parse SUP or JSON text into a value

Synopsis

parse_sup(s: string) -> any

Description

The parse_sup function parses the s argument that must be in the form of SUP or JSON into a value of any type. This is analogous to JavaScript’s JSON.parse() function.

Examples


Parse SUP text

# spq
foo := parse_sup(foo)
# input
{foo:"{a:\"1\",b:2}"}
# expected output
{foo:{a:"1",b:2}}

Parse JSON text

# spq
foo := parse_sup(foo)
# input
{"foo": "{\"a\": \"1\", \"b\": 2}"}
# expected output
{foo:{a:"1",b:2}}