savvy v0.1.0 Savvy.JSON View Source

Encode & decode JSON

Link to this section Summary

Functions

Parses a JSON value from an input string

Link to this section Functions

Link to this function

decode(string) View Source
decode(bitstring()) :: {:ok, map()} | {:error, bitstring()}

Parses a JSON value from an input string.

Examples

iex> Savvy.JSON.decode("{}")
{:ok, %{}}

iex> Savvy.JSON.decode("invalid")
{:error, "invalid json"}