Authors: Nicholas Lundgaard (nalundgaard@gmail.com).
| as_map/1 | convert any JSON objects in the input JSON term into map format. |
| as_proplist/1 | convert any JSON objects in the input JSON term into proplist format. |
| copy/3 | given a list of paths, a source object/array and one or more destination objects/arrays, copy the path-value pairs from the source to the destination(s), and return a list with the results. |
| copy/4 | given a list of paths, a source json_object and one or more destination json_objects, retrieve the value from the source object at the current path, pass it through the mutator function, and store it on the destination object(s) at the same path; return the destination object(s). |
| delete/2 | given a path and a json_object, if the path is in the object, return a new json_object identical to the given one, with the exception that it does not contain the path, value pair referred to by the input path. |
| delete_if_equal/3 | given a path, a value or list of values, and a json term, check if the path contains any of the given Value(s); if so, delete the path from the object. |
| delete_list/2 | given a list of paths and a json_object, apply delete/2 to each path on the same json_object and return the result. |
| equal/3 | given a list of paths, an original json_object, and a single or list of new json_objects, verify that each path in each of the other object(s) has the same value as the original does at the same path, for each path in the list of paths; if so, return ok; otherwise, return an error tuple with the error type and a summary of mismatches for the first mismatched object. |
| equal/4 | given a list of fields, an original json_object, and a single or list of new json_objects, verify that each path in each of the other object(s) has the same value as the original does at the same path, for each path in the list of paths; if so, return ok; otherwise, return an error tuple with the error type and a summary of mismatches for the first mismatched object. |
| find/3 | given a path, search term, and a list of json objects, find all the elements of the list where the path in the element matches the search term. |
| find/4 | given a path, a subpath to be search objects in that list, a search term, and an object containing a list of objects at the given path, find all the elements of the list where the path in the element matches the given search term. |
| from_map/1 | convert a JSON term with map-format JSON objects into an identical JSON term with all of the JSON objects converted into the default format. |
| from_map/2 | convert a JSON term with map-format JSON objects into an identical JSON term with all of the JSON objects converted into the specified object format. |
| from_proplist/1 | convert a JSON term with proplist-format JSON objects into an identical JSON term with all of the JSON objects converted into the default format. |
| from_proplist/2 | convert a JSON term with proplist-format JSON objects into an identical JSON term with all of the JSON objects converted into the specified object format. |
| get/2 | given a path and a json_object, if the path is in the object, return the value at the path. |
| get/3 | given a path and a json_object, if the path is in the object, return the value at the path. |
| get_list/2 | given a list of paths and a json_object, return the values found
at each path in a list; if a path does not exist, return undefined. |
| get_list/3 | given a list of paths and a json_object, return the values found
at each path in a list; if a path does not exist, return undefined. |
| is_equal/2 | given 2 json terms A and B in any format (eep18, struct, proplist, or map, if supported), return true if they are equivalent. |
| is_subset/2 | given 2 json terms A and B in any format (eep18, struct, proplist), return true if all the value(s) in A are present in B. |
| new/0 | return an empty json_object in the default format. |
| new/1 | given a path, value tuple or a list of such tuples, return a new json_object in the default format with the given path(s) and value(s). |
| new/2 | given a path, value tuple or a list of such tuples, return a new json_object with the given path(s) and value(s). |
| path_elements/1 | given a path, parse it into an ordered list of json keys (binary) and/or array indexes. |
| path_elements_map/1 | given a list of paths, construct a unified map of the path elements of
all the paths; leaf elements will end with the value true; path elements
that are in the atom table will be multiplexed in the unified map, with both
the binary and atom form of the path element; for use in with/2 and
without/2. |
| path_transform/2 | given a list of path transforms as {old_path, new_path}, modify the
input object by renaming the old path to the new path and saving
the result into a new return object. |
| select/2 | Transforms a list of Elements according to a given Selectionification. |
| select/3 | Same as select/2 but it first filters the elements according to a given list of Conditions. |
| set/3 | given a path, value, and a json_object, return a new json_object containing the path and value. |
| set_list/2 | given a list of {Path, Value} tuples, apply the set/3 function
to the each path and value pair with the given object, and return the result. |
| transform/2 | given a list of transforms as {path, fun/1}, modify the input object
by retrieving the value in the path, applying the given function and saving
the result into a new return object. |
| with/2 | return a new object with the given paths and their associated values from the given object; any path that does not exist in the object is ignored. |
| without/2 | return a new object without the given paths and their associated values from the given object; any path does not exist in the given object is ignored. |
as_map(M::json_term()) -> json_term()
convert any JSON objects in the input JSON term into map format
as_proplist(M::json_term()) -> json_term()
convert any JSON objects in the input JSON term into proplist format
copy(PathList::paths(), SrcObject::json_object() | json_array(), DstObjects::json_object() | json_array()) -> json_array()
given a list of paths, a source object/array and one or more destination objects/arrays, copy the path-value pairs from the source to the destination(s), and return a list with the results
if the path does not exist in object, the destination(s) will have the
atom undefined as the value
copy(PathList::paths(), SrcObject::json_object() | json_array(), DstObjects::json_object() | json_array(), Mutator::fun((json_term() | undefined) -> json_term())) -> json_array()
given a list of paths, a source json_object and one or more destination json_objects, retrieve the value from the source object at the current path, pass it through the mutator function, and store it on the destination object(s) at the same path; return the destination object(s)
if the path does not exist in object, the destination(s) will have the
atom undefined as the value; the passed function should be prepared
to handle a value of undefined
delete(Path::path(), Object::json_object()) -> json_object()
given a path and a json_object, if the path is in the object, return a new json_object identical to the given one, with the exception that it does not contain the path, value pair referred to by the input path
delete_if_equal(Path::path(), ValueOrValues::json_term(), Object::json_object()) -> json_object()
given a path, a value or list of values, and a json term, check if the path contains any of the given Value(s); if so, delete the path from the object
delete_list(PathList::paths(), Object::json_object()) -> json_object()
given a list of paths and a json_object, apply delete/2 to each path on the same json_object and return the result
equal(Paths::paths(), Original::json_object() | json_array(), OtherOrOthers::json_object() | json_array()) -> ok | {error, {not_equal, Message::binary()}}
given a list of paths, an original json_object, and a single or list of new json_objects, verify that each path in each of the other object(s) has the same value as the original does at the same path, for each path in the list of paths; if so, return ok; otherwise, return an error tuple with the error type and a summary of mismatches for the first mismatched object
equal(Paths::paths(), OriginalObject::json_object() | json_array(), OtherObjectOrObjects::json_object() | json_array(), Mode::soft | hard) -> ok | {error, {not_equal, Message::binary()}}
given a list of fields, an original json_object, and a single or list of new json_objects, verify that each path in each of the other object(s) has the same value as the original does at the same path, for each path in the list of paths; if so, return ok; otherwise, return an error tuple with the error type and a summary of mismatches for the first mismatched object
if mode is soft, a mismatch is allowed if the value is missing from any of the new objectsfind(Path::path(), SearchTerm::json_term(), Objects::json_array()) -> json_array()
given a path, search term, and a list of json objects, find all the elements of the list where the path in the element matches the search term
find(Path::path(), Subpath::path(), SearchTerm::json_term(), Object::json_object() | json_array()) -> json_array()
given a path, a subpath to be search objects in that list, a search term, and an object containing a list of objects at the given path, find all the elements of the list where the path in the element matches the given search term
from_map(T::json_term()) -> json_term()
convert a JSON term with map-format JSON objects into an identical JSON term with all of the JSON objects converted into the default format
from_map(M::json_term(), Opts::jsn_options()) -> json_term()
convert a JSON term with map-format JSON objects into an identical JSON term with all of the JSON objects converted into the specified object format
from_proplist(T::json_term()) -> json_term()
convert a JSON term with proplist-format JSON objects into an identical JSON term with all of the JSON objects converted into the default format
from_proplist(T::json_term(), Opts::jsn_options()) -> json_term()
convert a JSON term with proplist-format JSON objects into an identical JSON term with all of the JSON objects converted into the specified object format
get(Path::path(), Object::json_object() | json_array()) -> json_term() | undefined
given a path and a json_object, if the path is in the object, return the value at the path. Otherwise, return undefined
get(Path::path(), Object::json_term(), Default::term()) -> json_term() | term()
given a path and a json_object, if the path is in the object, return the value at the path. Otherwise, return Default
get_list(PathList::paths(), Object::json_term()) -> [json_term() | undefined]
given a list of paths and a json_object, return the values found
at each path in a list; if a path does not exist, return undefined
get_list(PathList::paths(), Object::json_term(), Default::term()) -> [json_term() | term()]
given a list of paths and a json_object, return the values found
at each path in a list; if a path does not exist, return undefined
is_equal(A::json_term(), B::json_term()) -> boolean()
given 2 json terms A and B in any format (eep18, struct, proplist, or map, if supported), return true if they are equivalent
is_subset(A::json_term(), B::json_term()) -> boolean()
given 2 json terms A and B in any format (eep18, struct, proplist), return true if all the value(s) in A are present in B
CAUTION: this comparison treats json array comparisons as subset comparisons, not just object comparisons. so,is_subset([1,1,1], [1,2]) is true
new() -> json_object()
return an empty json_object in the default format
new(L::path_value_tuple() | path_value_tuples()) -> json_object()
given a path, value tuple or a list of such tuples, return a new json_object in the default format with the given path(s) and value(s)
new(L::path_value_tuple() | path_value_tuples(), Options::jsn_options()) -> json_object()
given a path, value tuple or a list of such tuples, return a new json_object with the given path(s) and value(s)
path_elements(Path::path()) -> path_elements()
given a path, parse it into an ordered list of json keys (binary) and/or array indexes
path_elements_map(Paths::paths()) -> path_elements_map()
given a list of paths, construct a unified map of the path elements of
all the paths; leaf elements will end with the value true; path elements
that are in the atom table will be multiplexed in the unified map, with both
the binary and atom form of the path element; for use in with/2 and
without/2
path_transform(Transforms::[{path(), path()}], Object::json_object()) -> json_object()
given a list of path transforms as {old_path, new_path}, modify the
input object by renaming the old path to the new path and saving
the result into a new return object
it's possible that the given path may specify an existing path; if so, the transformation will replace the existing path with the old path value
if the old_path is not present, the existing object will be returnselect(Selection::selection() | selections(), Elements::json_array()) -> json_array()
Transforms a list of Elements according to a given Selectionification
select(Selection::selection() | selections(), Condition::condition() | conditions(), Elements::json_array()) -> json_array()
Same as select/2 but it first filters the elements according to a given list of Conditions
set(Path::path(), Object::json_object(), Value::json_term()) -> json_object()
given a path, value, and a json_object, return a new json_object containing the path and value
set_list(TupleList::path_value_tuples(), Object::json_object()) -> json_object()
given a list of {Path, Value} tuples, apply the set/3 function
to the each path and value pair with the given object, and return the result
transform(Transforms::[{path(), fun((json_term()) -> json_term())}], Object::json_object()) -> json_object()
given a list of transforms as {path, fun/1}, modify the input object
by retrieving the value in the path, applying the given function and saving
the result into a new return object
undefined
with(Paths::paths() | path_elements_map(), JsonTerm::json_term()) -> json_term()
return a new object with the given paths and their associated values from the given object; any path that does not exist in the object is ignored
without(Paths::paths() | path_elements_map(), JsonTerm::json_term()) -> json_term()
return a new object without the given paths and their associated values from the given object; any path does not exist in the given object is ignored
Generated by EDoc