JSON.Parser.String (Raxol v0.5.0)

View Source

Implements a JSON String Parser for Bitstring values

Summary

Functions

parses a valid JSON string, returns its elixir representation

Functions

parse(json)

parses a valid JSON string, returns its elixir representation

Examples

iex> JSON.Parser.String.parse ""
{:error, :unexpected_end_of_buffer}

iex> JSON.Parser.String.parse "face0ff"
{:error, {:unexpected_token, "face0ff"}}

iex> JSON.Parser.String.parse "-hello"
{:error, {:unexpected_token, "-hello"}}

iex> JSON.Parser.String.parse "129245"
{:error, {:unexpected_token, "129245"}}

iex> JSON.Parser.String.parse ""7.something""
{:ok, "7.something", ""}

iex> JSON.Parser.String.parse ""-88.22suffix" foo bar"
{:ok, "-88.22suffix", " foo bar"}

iex> JSON.Parser.String.parse ""star -> \u272d <- star""
{:ok, "star -> ✭ <- star", ""}

iex> JSON.Parser.String.parse ""\u00df ist wunderbar""
{:ok, "ß ist wunderbar", ""}

iex> JSON.Parser.String.parse ""Rafaëlla" foo bar"
{:ok, "Rafaëlla", " foo bar"}

iex> JSON.Parser.String.parse ""Éloise woot" Éloise"
{:ok, "Éloise woot", " Éloise"}