convert/json

Values

pub fn decoder(
  of: convert.GlitrType,
) -> decode.Decoder(convert.GlitrValue)

Create a Gleam decoder for the provided GlitrType. This is not meant to be used directly ! It is better to use converters.

pub fn encode_value(val: convert.GlitrValue) -> json.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: convert.Converter(a),
) -> fn(String) -> Result(a, json.DecodeError)

Decode a Json string using the provided converter.

pub fn json_decode_bits(
  converter: convert.Converter(a),
) -> fn(BitArray) -> Result(a, json.DecodeError)

Decode a Json bit array using the provided converter.

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

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

Search Document