This commit includes an optimization that increases overall
performance.
The gains are roughly between 20% to 300% depending on the size
of the JSON document. Larger documents will see the greates gains,
particularly when searching for keys that are deeply embedded, or
near the end of the document.
The "@keys" and "@values" modifiers converts an object into an
array of its keys or values respectively.
Take this json for example:
{"first":"Tom","last":"Smith"}
@keys -> ["first","last"]
@values -> ["Tom","Smith"]
This feature was requested in #161.
`@flatten` Flattens an array with child arrays.
[1,[2],[3,4],[5,[6,7]]] -> [1,2,3,4,5,[6,7]]
The {"deep":true} arg can be provide for deep flattening.
[1,[2],[3,4],[5,[6,7]]] -> [1,2,3,4,5,6,7]
The original json is returned when the json is not an array.
`@join` Joins multiple objects into a single object.
[{"first":"Tom"},{"last":"Smith"}] -> {"first","Tom","last":"Smith"}
The arg can be "true" to specify that duplicate keys should be preserved.
[{"first":"Tom","age":37},{"age":41}] -> {"first","Tom","age":37,"age":41}
Without preserved keys:
[{"first":"Tom","age":37},{"age":41}] -> {"first","Tom","age":41}
The original json is returned when the json is not an object.
`@valid` Ensures that the json is valid before moving on. An
empty string is returned when the json is not valid, otherwise
it returns the original json.
A modifier is a path component that performs custom processing on
the json.
Multiple paths can be "chained" together using the pipe character.
This is useful for getting results from a modified query.
See the README file for more information.