JSON serialization - Factor Documentation (original) (raw)

The json vocabulary defines words for working with JSON (JavaScript Object Notation) formats.

Parsing strings in JSON format:

json> ( string -- object )

read-json ( -- object )
read-jsons ( -- objects )
path>json ( path -- json )
path>jsons ( path -- jsons )

Converting objects to JSON format:

>json ( obj -- string )

write-json ( obj -- )

Working with JSON null values:

json-null? ( object -- ? )

if-json-null ( x if-null else -- )
when-json-null ( x if-null -- )
unless-json-null ( x else -- )

Working with JSON Lines format:

jsonlines> ( string -- objects )

read-jsonlines ( -- objects )
>jsonlines ( objects -- string )
write-jsonlines ( objects -- )

For more information, see https://en.wikipedia.org/wiki/JSON.