Main decoder for TOON format.
Parses TOON format strings and converts them to Elixir data structures.
Summary
Functions
Decodes a TOON format string to Elixir data.
Decodes a TOON format string to Elixir data, raising on error.
Types
Functions
@spec decode( String.t(), keyword() ) :: {:ok, term()} | {:error, ToonEx.DecodeError.t()}
Decodes a TOON format string to Elixir data.
Options
:keys- How to decode map keys::strings|:atoms|:atoms!(default::strings)
Examples
iex> ToonEx.Decode.decode("name: Alice")
{:ok, %{"name" => "Alice"}}
iex> ToonEx.Decode.decode("age: 30")
{:ok, %{"age" => 30}}
iex> ToonEx.Decode.decode("tags[2]: a,b")
{:ok, %{"tags" => ["a", "b"]}}
iex> ToonEx.Decode.decode("name: Alice", keys: :atoms)
{:ok, %{name: "Alice"}}
Decodes a TOON format string to Elixir data, raising on error.
Examples
iex> ToonEx.Decode.decode!("name: Alice")
%{"name" => "Alice"}
iex> ToonEx.Decode.decode!("count: 42")
%{"count" => 42}