The only purpose of using the built-in Go was to encode json
strings that had unicode or needed to escaped.
This commit adds the new function `AppendJSONString` which allows
for appending strings as their json representation to a byte
slice.
It's about 2x faster than using json.Marshal.
The new "@group" modifier allows for grouping arrays of objects.
For example, using the "@group" modifier on the following json...
{"id":["123","456","789"],"val":[2,1]}
will results in...
[{"id":"123","val":2},{"id":"456","val":1},{"id":"789"}]
This commit adds a two new functions of the Result type:
- Result.Path: Returns the original path of a `Result` that was
returned from a simple `Get` operation.
- Result.Paths: Returns the original paths of a `Result` that was
returned from a `Get` operation with a query.
See issue #206 for more details
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.
This commit adds the uses the MatchLimit function, which it the
same as Match but will limit the complexity of the input pattern.
This is to avoid long running matches, specifically to avoid ReDos
attacks from arbritary inputs.
This commit adds the new tilde '~' operator, which when used will
convert a value to a boolean before comparison.
For example, using the following JSON:
{
"vals": [
{ "a": 1, "b": true },
{ "a": 2, "b": true },
{ "a": 3, "b": false },
{ "a": 4, "b": "0" },
{ "a": 5, "b": 0 },
{ "a": 6, "b": "1" },
{ "a": 7, "b": 1 }
{ "a": 8, "b": "true" },
{ "a": 9, "b": false }
{ "a": 10, "b": null }
{ "a": 11 }
]
}
You can now query for all true(ish) values:
vals.#(b==~true)#
Which returns:
[1,2,6,7,8]
Or all false(ish) values:
vals.#(b==~false)#
Which returns:
[3,4,5,9,10,11]
The last value which was non-existent is treated as "false"