json v1.0.3 JSON.Parser.Bitstring.String View Source

Implements a JSON String Parser for Bitstring values

Link to this section Summary

Functions

parses a valid JSON string, returns its elixir representation

Link to this section Functions

parses a valid JSON string, returns its elixir representation

Examples

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

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

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

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

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

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

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

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

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

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