json

JSON values are mapped to Minilang as follows:

  • nullnil

  • truetrue

  • falsefalse

  • integerinteger

  • realreal

  • stringstring

  • arraylist

  • objectmap

meth json::encode(Value: any): string | error

Encodes Value into JSON, raising an error if Value cannot be represented as JSON.

type json < string

Contains a JSON encoded value. Primarily used to distinguish strings containing JSON from other strings (e.g. for CBOR encoding).

fun json(Value: any): json

Encodes Value into JSON.

meth (Json: json):decode: any | error

Decodes the JSON string in Json into a Minilang value.

meth (Json: json):value: any | error

Decodes the JSON string in Json into a Minilang value.

type json::decoder < stream

A JSON decoder that can be written to as a stream and calls a user-supplied callback whenever a complete value is decoded.

fun json::decoder(Callback: any): json::decoder

Returns a new JSON decoder that calls Callback(Value) whenever a complete JSON value is written to the decoder.

meth json::decode(Stream: stream): any

Decodes the content of Json into a Minilang value.

meth json::decode(Json: string): any

Decodes Json into a Minilang value.