z_json (zotonic_core v1.0.0-rc.12)

JSON support routines.

Link to this section Summary

Functions

Decode a JSON binary to an Erlang term.
Encode an Erlang term to JSON.
JSON escape for safe quoting of JSON strings. Subtly different from JS escape, see http://www.json.org/

Link to this section Functions

-spec decode(binary() | undefined) -> term().
Decode a JSON binary to an Erlang term.
-spec encode(binary() | map() | list() | undefined) -> binary().
Encode an Erlang term to JSON.
Link to this function

json_escape(Value)

-spec json_escape(iodata() | undefined) -> iodata().
JSON escape for safe quoting of JSON strings. Subtly different from JS escape, see http://www.json.org/