View Source Blazer (blazer v0.1.1)
Blazer is a case parser for json keys.
available case options:
:camelexample:camelCase:pascalexample:PascalCase:snakeexample:snake_case:upperexample:UPPERCASE:kebabexample:kebab-case:titleexample:Title Case
Link to this section Summary
Functions
Decode a JSON into a map and parse its keys
encode a map into JSON after parsing its keys
Parses a map or a string to the desired case
Link to this section Types
Specs
opts() :: [ case: :camel | :pascal | :snake | :upper | :kebab | :title, keys: :strings | :atoms | :atoms! ]
Link to this section Functions
Specs
Decode a JSON into a map and parse its keys
opts is passed to Jason, so all its options can be used
Specs
Specs
encode a map into JSON after parsing its keys
opts is passed to Jason, so all its options can be used
Specs
Specs
Specs
parse(String.t() | map(), Blazer.Structs.Opts.t()) :: {:ok, String.t() | map()} | {:error, String.t()}
Parses a map or a string to the desired case
iex(1)> Blazer.parse(%{"firstKey" => "data", "secondKey" => "data"}, case: :snake, keys: :atoms)
{:ok, %{first_key: "data", second_key: "data"}}
iex(2)> Blazer.parse("john_doe", case: :title)
{:ok, "John Doe"}