jaxon
jaxon copied to clipboard
Towards a shared understanding of JSONPath
You might find https://cburgmer.github.io/json-path-comparison/ interesting to align with other implementations of JSONPath. To give an idea what's possible here are two queries which are currently not supported by jaxon/return the wrong results.
-
[ ]
$[-1]Input:["first", "second", "third"]Expected output:
["third"]Actual output:
[] -
[ ]
$..keyInput:{"object": {"key": "value", "array": [{"key": "something"}, {"key": {"key": "russian dolls"}}]}, "key": "top"}Expected output:
["russian dolls", "something", "top", "value", {"key": "russian dolls"}]Actual output:
["top"]
Let me know if this is helpful to you.
For reference, the output was generated by the program in https://github.com/cburgmer/json-path-comparison/tree/master/implementations/Elixir_jaxon.
Thank you for the library.
Hi @cburgmer
I am wondering how to slice the json?
I tried Jaxon.Stream.query(Jaxon.Path.parse!("$[0:3].Player")) to get first 3 players I have, but it does not work.
How can I use it correctly to get only partial data and filters?
Should I use Enum.take?