Jason.Structs.Decoder (jason_structs v0.3.0) View Source

A JSON Decoder that can decode a JSON to a Jason.Structs struct, if its module is provided.

The decoding process is recursive and if the strcut has fields that are Jason.Structs structs, they are also decoded.

If the struct has fields, that are normal structs they'll be decoded as maps.

Link to this section Summary

Functions

Decodes the passed iodata JSON to a struct of the given struc_module type.

Link to this section Functions

Link to this function

decode(json, struc_module \\ nil)

View Source

Specs

decode(json :: iodata(), struc_module :: module() | nil) ::
  {:ok, map()} | {:error, term()}

Decodes the passed iodata JSON to a struct of the given struc_module type.

If the struc_module is passed as nil, the result is just a map.