json¶
JSON values are mapped to Minilang as follows:
null
↔nil
true
↔true
false
↔false
integer ↔
integer
real ↔
real
string ↔
string
array ↔
list
object ↔
map
meth json::decode(Json: address): any
Decodes
Json
into a Minilang value.meth json::encode(Value: any): string | error
Encodes
Value
into JSON, raising an error ifValue
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::encode(Buffer: string::buffer, Value: any)
TBD