These are the most basic functions you can use to read data from JSON. They take the value you ask for out of binary JSON if it's there. They return {Bin, Rest} or an atom representing an error. They will also skip whitespace.
For more information on how to use these functions and what a pull parser is, read the Overview.null/1 | Try to read a null from the JSON. |
boolean/1 | Try to read a boolean from the JSON. |
string/1 | Try to read a string from the JSON. |
number/1 | Try to read a number from the JSON. |
array/1 | Try to read an array from the JSON. |
element/1 | Try to read the next array element from the JSON. |
object/1 | Try to read an object from the JSON. |
key/1 | Try to read the next object key from the JSON. |
null(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | not_null
Try to read a null from the JSON.
If it's there, it will be returned as a binary <<"null">>
.
boolean(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | not_boolean
Try to read a boolean from the JSON.
If it's there, it will be returned as a binary <<"true">>
or <<"false">>
.
string(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | not_string | unterminated_string
Try to read a string from the JSON. If it's there, it will be returned without any sort of processing. This means escape sequences and the quotation marks on the edges are still there.
See also: jsonpull:unescape_and_strip/1.
number(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | not_number
Try to read a number from the JSON. If it's there, it will be returned as a binary string in its original form.
array(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | not_array
Try to read an array from the JSON.
If an array is starting here, the binary <<"[">>
will be returned.
element(JSON::binary()) -> {ReadValue::binary(), Rest::binary()}
Try to read the next array element from the JSON.
If there is an element, either the binary <<",">>
or an empty binary will be returned.
If the array is ending, the binary <<"]">>
will be returned.
object(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | not_object
Try to read an object from the JSON.
If there is an object, the binary <<"{">>
will be returned.
key(JSON::binary()) -> {ReadValue::binary(), Rest::binary()} | missing_colon_after_key | unterminated_key | key_not_string
Try to read the next object key from the JSON.
If there is a key, it will be returned as a raw string,
with the same caveats as string/1
.
If the object is ending, the binary <<"}">>
will be returned.
Generated by EDoc