mcl_core_lan_json (mcl_core v1.0.0)

View Source

Erlang terms as JSON for the LAN entry point (mcl-core#4).

A capability answers with an Erlang term, and the mesh carries it as CBOR. For the entry point's JSON clients: a map stays a map, its keys turned into strings; a list or tuple becomes an array; an atom its name (true, false and null stay JSON's); a binary that is UTF-8 a string, and any other binary {"$bytes": <base64url>}. A pid, port, reference or fun has no JSON form and raises {unencodable, Term}.

Summary

Functions

Bytes as the entry point writes them: base64url without padding.

Term as JSON text.

Term as the value jsx encodes.

Functions

bytes(Bin)

-spec bytes(binary()) -> binary().

Bytes as the entry point writes them: base64url without padding.

encode(Term)

-spec encode(term()) -> binary().

Term as JSON text.

value(Bin)

-spec value(term()) -> term().

Term as the value jsx encodes.