Module sr_json

Json abstraction library.

Description

Json abstraction library

Data Types

json()

json() = object() | [object()] | binary() | number() | boolean() | null

key()

key() = binary() | atom()

object()

object() = #{key() => json()}

Function Index

decode/1String to internal representation.
decode_date/1Parse binaries as datetimes using iso8601.
decode_null/1Decode 'null' as 'undefined'.
encode/1Internal representation to string.
encode_date/1Format datetimes as binaries using iso8601.
encode_null/1Encode 'undefined' as 'null'.
error/1Format errors as jsons.

Function Details

decode/1

decode(Data::iodata()) -> json()

String to internal representation

decode_date/1

decode_date(DateTime::binary()) -> calendar:datetime()

Parse binaries as datetimes using iso8601

To do

decode_null/1

decode_null(Json::null) -> undefined

Decode 'null' as 'undefined'. Leave everything else as is.

encode/1

encode(Json::json()) -> iodata()

Internal representation to string

encode_date/1

encode_date(DateTime::calendar:datetime()) -> binary()

Format datetimes as binaries using iso8601

encode_null/1

encode_null(Json::undefined) -> null

Encode 'undefined' as 'null'. Leave everything else as is.

error/1

error(Error::binary()) -> iodata()

Format errors as jsons. Given the error Reason, this function returns the json equivalent to {"error": "Reason"}.


Generated by EDoc, Sep 12 2016, 12:29:07.