-
-
-
-
- - json -
-- v0.3.3 -
-
-
-
-
-
- -
-
- Pages - - -
- Modules - - - -
- Exceptions - - - -
- Protocols - -
diff --git a/README.md b/README.md index 36dc93b..a1952f3 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ This library provides a natively implemented JSON encoder and decoder for Elixir All contributions are welcome. ## Installing -Simply add ```{:json, "~> 0.3.0"}``` to your project's ```mix.exs``` file, in the dependencies list and run ```mix deps.get json```. +Simply add ```{:json, "~> 1.0"}``` to your project's ```mix.exs``` file, in the dependencies list and run ```mix deps.get json```. ### Example for a project that already uses [Dynamo](https://github.com/dynamo/dynamo): ```elixir diff --git a/doc/404.html b/doc/404.html index 924844d..216e018 100644 --- a/doc/404.html +++ b/doc/404.html @@ -5,7 +5,7 @@ -
Callback implementation for c:Exception.exception/1
Callback implementation for c:Exception.message/1
Callback implementation for c:Exception.exception/1
.
Callback implementation for c:Exception.message/1
.
Callback implementation for c:Exception.exception/1
Callback implementation for c:Exception.message/1
Callback implementation for c:Exception.exception/1
.
Callback implementation for c:Exception.message/1
.
Callback implementation for c:Exception.exception/1
Callback implementation for c:Exception.message/1
Callback implementation for c:Exception.exception/1
.
Callback implementation for c:Exception.message/1
.
Callback implementation for c:Exception.exception/1
Callback implementation for c:Exception.message/1
Callback implementation for c:Exception.exception/1
.
Callback implementation for c:Exception.message/1
.
parses a valid chain of escaped unicode and returns the string representation, +plus the remainder of the string
+parses a valid chain of escaped unicode and returns the string representation, +plus the remainder of the string
+iex> JSON.Parser.Bitstring.parse ""
+{:error, :unexpected_end_of_buffer}
+
+iex> JSON.Parser.Bitstring.parse "face0ff"
+{:error, {:unexpected_token, "face0ff"} }
+
+iex> JSON.Parser.Bitstring.parse "-hello"
+{:error, {:unexpected_token, "-hello"} }
+
parses a valid chain of escaped unicode and returns the string representation, +plus the remainder of the string
+parses a valid chain of escaped unicode and returns the string representation, +plus the remainder of the string
+iex> JSON.Unicode.Charlist.parse ''
+{:error, :unexpected_end_of_buffer}
+
+iex> JSON.Unicode.Charlist.parse 'face0ff'
+{:error, {:unexpected_token, 'face0ff'} }
+
+iex> JSON.Unicode.Charlist.parse '-hello'
+{:error, {:unexpected_token, '-hello'} }
+
decode(char_list) :: {atom, term}
+ decode(charlist) :: {atom, term}
decode(bitstring) :: {atom, term}
@@ -180,7 +180,7 @@ decode!(char_list) :: term
+ decode!(charlist) :: term
decode!(bitstring) :: term
@@ -208,7 +208,7 @@ exception(args) | - -Callback implementation of |
-
-
message(exception) | - -Callback implementation of |
-
-
Specs:
-Callback implementation of Exception.exception/1
.
Specs:
-Callback implementation of Exception.message/1
.
exception(args) | - -Callback implementation of |
-
-
message(exception) | - -Callback implementation of |
-
-
Specs:
-Callback implementation of Exception.exception/1
.
Specs:
-Callback implementation of Exception.message/1
.
exception(args) | - -Callback implementation of |
-
-
message(exception) | - -Callback implementation of |
-
-
Specs:
-Callback implementation of Exception.exception/1
.
Defines the protocol required for converting raw JSON into Elixir terms
- -decode(bitstring_or_char_list) | - -Returns an atom and an Elixir term - |
-
-
run(result_object) | - -
run(filtered_response, conn) | - -
finalize(conn) | - -
exception(args) | - -Callback implementation of |
-
-
message(exception) | - -Callback implementation of |
-
-
Specs:
-Callback implementation of Exception.exception/1
.
Helper functions for writing JSON.Encoder instances.
- -dict_encode(coll) | - -Given an enumerable that yields tuples of |
-
-
enum_encode(coll) | - -Given an enumerable encode the enumerable as an array - |
-
-
Given an enumerable that yields tuples of {key, value}
encode the enumerable
-as an object.
Defines the protocol required for converting Elixir types into JSON and inferring their json types.
- -encode(term) | - -Returns a JSON string representation of the Elixir term - |
-
-
typeof(term) | - -Returns an atom that reprsents the JSON type for the term - |
-
-
Specs:
-Returns a JSON string representation of the Elixir term
-
-iex> JSON.Encoder.encode([result: "this will be a elixir result"])
-{:ok, "{\"result\":\"this will be a elixir result\"}"}
-
-
-
-
-parse(json) | - -parses a valid JSON array value, returns its elixir list representation - |
-
-
parses a valid JSON array value, returns its elixir list representation
-
-iex> JSON.Parser.Bitstring.Array.parse ""
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Bitstring.Array.parse "[1, 2 "
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Bitstring.Array.parse "face0ff"
-{:error, {:unexpected_token, "face0ff"} }
-
-iex> JSON.Parser.Bitstring.Array.parse "[] lala"
-{:ok, [], " lala" }
-
-iex> JSON.Parser.Bitstring.Array.parse "[]"
-{:ok, [], "" }
-
-iex> JSON.Parser.Bitstring.Array.parse "[\"foo\", 1, 2, 1.5] lala"
-{:ok, ["foo", 1, 2, 1.5], " lala" }
-
-
-
-parse(binary) | - -parses a valid JSON numerical value, returns its elixir numerical representation - |
-
-
parses a valid JSON numerical value, returns its elixir numerical representation
-
-iex> JSON.Parser.Bitstring.Number.parse ""
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Bitstring.Number.parse "face0ff"
-{:error, {:unexpected_token, "face0ff"} }
-
-iex> JSON.Parser.Bitstring.Number.parse "-hello"
-{:error, {:unexpected_token, "hello"} }
-
-iex> JSON.Parser.Bitstring.Number.parse "129245"
-{:ok, 129245, "" }
-
-iex> JSON.Parser.Bitstring.Number.parse "7.something"
-{:ok, 7, ".something" }
-
-iex> JSON.Parser.Bitstring.Number.parse "7.4566something"
-{:ok, 7.4566, "something" }
-
-iex> JSON.Parser.Bitstring.Number.parse "-88.22suffix"
-{:ok, -88.22, "suffix" }
-
-iex> JSON.Parser.Bitstring.Number.parse "-12e4and then some"
-{:ok, -1.2e+5, "and then some" }
-
-iex> JSON.Parser.Bitstring.Number.parse "7842490016E-12-and more"
-{:ok, 7.842490016e-3, "-and more" }
-
-
-
-parse(json) | - -parses a valid JSON object value, returns its elixir representation - |
-
-
parses a valid JSON object value, returns its elixir representation
-
-iex> JSON.Parser.Bitstring.Object.parse ""
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Bitstring.Object.parse "face0ff"
-{:error, {:unexpected_token, "face0ff"} }
-
-iex> JSON.Parser.Bitstring.Object.parse "[] "
-{:error, {:unexpected_token, "[] "}}
-
-iex> JSON.Parser.Bitstring.Object.parse "[]"
-{:error, {:unexpected_token, "[]"}}
-
-iex> JSON.Parser.Bitstring.Object.parse "[\"foo\", 1, 2, 1.5] lala"
-{:error, {:unexpected_token, "[\"foo\", 1, 2, 1.5] lala"}}
-
-iex> JSON.Parser.Bitstring.Object.parse "{\"result\": \"this will be a elixir result\"} lalal"
-{:ok, Enum.into([{"result", "this will be a elixir result"}], Map.new), " lalal"}
-
-
-
-parse(json) | - -parses a valid JSON string, returns its elixir representation - |
-
-
parses a valid JSON string, returns its elixir representation
-
-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" }
-
-
-
-parse(bin) | - -parses a valid JSON value, returns its elixir representation - |
-
-
trim(bitstring) | - -parses valid JSON whitespace if it exists, returns the rest of the buffer - |
-
-
parses a valid JSON value, returns its elixir representation
-
-iex> JSON.Parser.Bitstring.parse ""
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Bitstring.parse "face0ff"
-{:error, {:unexpected_token, "face0ff"} }
-
-iex> JSON.Parser.Bitstring.parse "-hello"
-{:error, {:unexpected_token, "-hello"} }
-
-iex> JSON.Parser.Bitstring.parse "129245"
-{:ok, 129245, "" }
-
-iex> JSON.Parser.Bitstring.parse "7.something"
-{:ok, 7, ".something" }
-
-iex> JSON.Parser.Bitstring.parse "-88.22suffix"
-{:ok, -88.22, "suffix" }
-
-iex> JSON.Parser.Bitstring.parse "-12e4and then some"
-{:ok, -1.2e+5, "and then some" }
-
-iex> JSON.Parser.Bitstring.parse "7842490016E-12-and more"
-{:ok, 7.842490016e-3, "-and more" }
-
-iex> JSON.Parser.Bitstring.parse "null"
-{:ok, nil, ""}
-
-iex> JSON.Parser.Bitstring.parse "false"
-{:ok, false, "" }
-
-iex> JSON.Parser.Bitstring.parse "true"
-{:ok, true, "" }
-
-iex> JSON.Parser.Bitstring.parse "\"7.something\""
-{:ok, "7.something", "" }
-
-iex> JSON.Parser.Bitstring.parse "\"-88.22suffix\" foo bar"
-{:ok, "-88.22suffix", " foo bar" }
-
-iex> JSON.Parser.Bitstring.parse "\"star -> \\u272d <- star\""
-{:ok, "star -> ✭ <- star", "" }
-
-iex> JSON.Parser.Bitstring.parse "[]"
-{:ok, [], "" }
-
-iex> JSON.Parser.Bitstring.parse "[\"foo\", 1, 2, 1.5] lala"
-{:ok, ["foo", 1, 2, 1.5], " lala" }
-
-iex> JSON.Parser.Bitstring.parse "{\"result\": \"this will be a elixir result\"} lalal"
-{:ok, Enum.into([{"result", "this will be a elixir result"}], Map.new), " lalal"}
-
-
-
-parses valid JSON whitespace if it exists, returns the rest of the buffer
-
-iex> JSON.Parser.Bitstring.trim ""
-""
-
-iex> JSON.Parser.Bitstring.trim "xkcd"
-"xkcd"
-
-iex> JSON.Parser.Bitstring.trim " \t\r lalala "
-"lalala "
-
-iex> JSON.Parser.Bitstring.trim " \n\t\n fooo \u00dflalalal "
-"fooo \u00dflalalal "
-
-
-
-parse(json) | - -parses a valid JSON array value, returns its elixir list representation - |
-
-
parses a valid JSON array value, returns its elixir list representation
-
-iex> JSON.Parser.Charlist.Array.parse ''
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Charlist.Array.parse '[1, 2 '
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Charlist.Array.parse 'face0ff'
-{:error, {:unexpected_token, 'face0ff'} }
-
-iex> JSON.Parser.Charlist.Array.parse '[] lala'
-{:ok, [], ' lala' }
-
-iex> JSON.Parser.Charlist.Array.parse '[]'
-{:ok, [], '' }
-
-iex> JSON.Parser.Charlist.Array.parse '["foo", 1, 2, 1.5] lala'
-{:ok, ["foo", 1, 2, 1.5], ' lala' }
-
-
-
-parse(charlist) | - -parses a valid JSON numerical value, returns its elixir numerical representation - |
-
-
parses a valid JSON numerical value, returns its elixir numerical representation
-
-iex> JSON.Parser.Charlist.Number.parse ''
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Charlist.Number.parse 'face0ff'
-{:error, {:unexpected_token, 'face0ff'} }
-
-iex> JSON.Parser.Charlist.Number.parse '-hello'
-{:error, {:unexpected_token, 'hello'} }
-
-iex> JSON.Parser.Charlist.Number.parse '129245'
-{:ok, 129245, '' }
-
-iex> JSON.Parser.Charlist.Number.parse '7.something'
-{:ok, 7, '.something' }
-
-iex> JSON.Parser.Charlist.Number.parse '7.4566something'
-{:ok, 7.4566, 'something' }
-
-iex> JSON.Parser.Charlist.Number.parse '-88.22suffix'
-{:ok, -88.22, 'suffix' }
-
-iex> JSON.Parser.Charlist.Number.parse '-12e4and then some'
-{:ok, -1.2e+5, 'and then some' }
-
-iex> JSON.Parser.Charlist.Number.parse '7842490016E-12-and more'
-{:ok, 7.842490016e-3, '-and more' }
-
-
-
-parse(json) | - -parses a valid JSON object value, returns its elixir Map representation - |
-
-
parses a valid JSON object value, returns its elixir Map representation
-
-iex> JSON.Parser.Charlist.Object.parse ''
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Charlist.Object.parse 'face0ff'
-{:error, {:unexpected_token, 'face0ff'} }
-
-iex> JSON.Parser.Charlist.Object.parse '[] '
-{:error, {:unexpected_token, '[] '}}
-
-iex> JSON.Parser.Charlist.Object.parse '[]'
-{:error, {:unexpected_token, '[]'}}
-
-iex> JSON.Parser.Charlist.Object.parse '{"result": "this will be a elixir result"} lalal'
-{:ok, Enum.into([{"result", "this will be a elixir result"}], Map.new), ' lalal'}
-
-
-
-parse(json) | - -parses a valid JSON string, returns its elixir representation - |
-
-
parses a valid JSON string, returns its elixir representation
-
-iex> JSON.Parser.Charlist.String.parse ''
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Charlist.String.parse 'face0ff'
-{:error, {:unexpected_token, 'face0ff'} }
-
-iex> JSON.Parser.Charlist.String.parse '-hello'
-{:error, {:unexpected_token, '-hello'} }
-
-iex> JSON.Parser.Charlist.String.parse '129245'
-{:error, {:unexpected_token, '129245'} }
-
-iex> JSON.Parser.Charlist.String.parse '\"7.something\"'
-{:ok, "7.something", '' }
-
-iex> JSON.Parser.Charlist.String.parse '\"star -> \\u272d <- star\"'
-{:ok, "star -> ✭ <- star", '' }
-
-iex> JSON.Parser.Charlist.String.parse '\"\\u00df ist wunderbar\"'
-{:ok, "ß ist wunderbar", '' }
-
-iex> JSON.Parser.Charlist.String.parse '\"-88.22suffix\" foo bar'
-{:ok, "-88.22suffix", ' foo bar' }
-
-
-
-
-parse(charlist) | - -parses a valid JSON value, returns its elixir representation - |
-
-
trim(charlist) | - -parses valid JSON whitespace if it exists, returns the rest of the buffer - |
-
-
parses a valid JSON value, returns its elixir representation
-
-iex> JSON.Parser.Charlist.parse ''
-{:error, :unexpected_end_of_buffer}
-
-iex> JSON.Parser.Charlist.parse 'face0ff'
-{:error, {:unexpected_token, 'face0ff'} }
-
-iex> JSON.Parser.Charlist.parse '-hello'
-{:error, {:unexpected_token, '-hello'} }
-
-iex> JSON.Parser.Charlist.parse '129245'
-{:ok, 129245, '' }
-
-iex> JSON.Parser.Charlist.parse '7.something'
-{:ok, 7, '.something' }
-
-iex> JSON.Parser.Charlist.parse '-88.22suffix'
-{:ok, -88.22, 'suffix' }
-
-iex> JSON.Parser.Charlist.parse '-12e4and then some'
-{:ok, -1.2e+5, 'and then some' }
-
-iex> JSON.Parser.Charlist.parse '7842490016E-12-and more'
-{:ok, 7.842490016e-3, '-and more' }
-
-iex> JSON.Parser.Charlist.parse 'null'
-{:ok, nil, '' }
-
-iex> JSON.Parser.Charlist.parse 'false'
-{:ok, false, '' }
-
-iex> JSON.Parser.Charlist.parse 'true'
-{:ok, true, '' }
-
-iex> JSON.Parser.Charlist.parse '\"7.something\"'
-{:ok, "7.something", '' }
-
-iex> JSON.Parser.Charlist.parse '\"-88.22suffix\" foo bar'
-{:ok, "-88.22suffix", ' foo bar' }
-
-iex> JSON.Parser.Charlist.parse '[]'
-{:ok, [], '' }
-
-iex> JSON.Parser.Charlist.parse '["foo", 1, 2, 1.5] lala'
-{:ok, ["foo", 1, 2, 1.5], ' lala' }
-
-iex> JSON.Parser.Charlist.parse '{"result": "this will be a elixir result"} lalal'
-{:ok, Enum.into([{"result", "this will be a elixir result"}], Map.new), ' lalal'}
-
-
-
-parses valid JSON whitespace if it exists, returns the rest of the buffer
-
-iex> JSON.Parser.Charlist.trim ''
-''
-
-iex> JSON.Parser.Charlist.trim 'xkcd'
-'xkcd'
-
-iex> JSON.Parser.Charlist.trim ' \t\r lalala '
-'lalala '
-
-iex> JSON.Parser.Charlist.trim ' \n\t\n fooo \u00dflalalal '
-'fooo \u00dflalalal '
-
-
-
-decode!(bitstring_or_char_list) | - -|
decode(bitstring_or_char_list) | - -Converts a valid JSON string into an Elixir term - |
-
-
encode!(term) | - -|
encode(term) | - -Returns a JSON string representation of the Elixir term - |
-
-
Specs:
-Converts a valid JSON string into an Elixir term
-
-iex> JSON.decode("{\"result\":\"this will be an Elixir result\"}")
-{:ok, Enum.into([{"result", "this will be an Elixir result"}], Map.new) }
-
-
-
-Specs:
-Returns a JSON string representation of the Elixir term
-
-iex> JSON.encode([result: "this will be a JSON result"])
-{:ok, "{\"result\":\"this will be a JSON result\"}"}
-
-
-
-
-t |
JSON | - -|
JSON.Dynamo.Filter | - -|
JSON.Dynamo.Filter.FilterResultObject | - -|
JSON.Dynamo.Filter.ProcessFilteredResponse | - -|
JSON.Encoder.Helpers | - -Helper functions for writing JSON.Encoder instances - |
-
-
JSON.Parser.Bitstring | - -|
JSON.Parser.Bitstring.Array | - -|
JSON.Parser.Bitstring.Number | - -|
JSON.Parser.Bitstring.Object | - -|
JSON.Parser.Bitstring.String | - -|
JSON.Parser.Charlist | - -|
JSON.Parser.Charlist.Array | - -|
JSON.Parser.Charlist.Number | - -|
JSON.Parser.Charlist.Object | - -|
JSON.Parser.Charlist.String | - -
JSON.Decoder.Error | - -
JSON.Decoder.UnexpectedEndOfBufferError | - -
JSON.Decoder.UnexpectedTokenError | - -
JSON.Encoder.Error | - -
JSON.Decoder | - -Defines the protocol required for converting raw JSON into Elixir terms - |
-
-
JSON.Encoder | - -Defines the protocol required for converting Elixir types into JSON and inferring their json types - |
-
-