glitr/convert/json

Functions

pub fn decode_value(
  of: GlitrType,
) -> fn(Dynamic) -> Result(GlitrValue, List(DecodeError))

Decode a JSON value using the specified GlitrType as the shape of the data.
Returns the corresponding GlitrValue representation. This isn’t meant to be used directly !

pub fn encode_value(val: GlitrValue) -> Json

Encode a GlitrValue into its corresponding JSON representation.
This is not meant to be used directly !
It is better to use converters.

pub fn json_decode(
  converter: Converter(a),
) -> fn(Dynamic) -> Result(a, List(DecodeError))

Decode a Json value using the provided converter.

pub fn json_encode(value: a, converter: Converter(a)) -> Json

Encode a value into the corresponding Json using the converter.
If the converter isn’t valid, a NullValue is returned.

Search Document