JSONabstractParse and generate JSON text.
parse: maps JSON onto plain Quoin values — object → Map, array → List, plus String / Integer / Double / Boolean / nil — and generate: / generatePretty: go the other way. Numbers are never silently lossy: an integer past 64 bits parses as a BigInteger, and a decimal a Double cannot represent exactly parses as a BigDecimal.
JSON.parse:'{"a": 1}' "* -> #{'a': 1} JSON.generate:#{'a': 1} "* -> '{"a":1}'
Generate the compact (single-line) JSON string for a value. Maps, Lists, Strings, numbers (including BigInteger / BigDecimal, at full precision), Booleans, and nil serialize; Map keys must be Strings; Bytes and other types throw a TypeError (encode Bytes with Base64 first).
JSON.generate:#{'a': 1 'b': #(1 2)} "* -> '{"a":1,"b":[1,2]}'
Like generate:, but indented for human eyes (two spaces, one key per line).
JSON.generatePretty:#{'a': 1} "* -> '{\n "a": 1\n}'
Parse a JSON string into Quoin values: object → Map, array → List, and String / Integer / Double / Boolean / nil for the scalars (BigInteger / BigDecimal when a number won't fit exactly). Malformed input throws a ParseError.
JSON.parse:'{"a": 1}' "* -> #{'a': 1} JSON.parse:'[1, 2, 3]' "* -> #(1 2 3)