A really simple wrapper for the JSONata javascript library. This library is loosely based on the pyjsonata bindings.
python3 -m pip install jsonata
import jsonata
jncontext = jsonata.Context()
try:
result = jncontext("[$.foo, $.bar[2]]", { "foo": "hi there", "bar": [1,2,3,5,8,13]})
except ValueError as exp:
...
By using this hack, the input JSON is patched so that all integers bigger than the JavaScript MAX_SAFE_INTEGER are converted to strings before invocating JSONata, and are converted back to integers in the result.
jncontext = jsonata.Context(bigint_patch=True)
Please note that due to API changes and possible implementation changes, the python JSONata module is currently pinned to version 1.8.6 of JSONata.
In short, JSONata 2.0.0 broke things, adding an 'await' to the bindings didn't fix it, and I haven't have time to look into it any deeper so far. If anyone wants to have a go at fixing it, pull requests are highly welcome at this time.