Library to parse and execute JSONPath
|LTS Haskell 20.16:||0.3.0.0|
|Stackage Nightly 2023-03-27:||0.3.0.0|
|Latest on Hackage:||0.3.0.0|
Module documentation for 0.3.0.0
Implementation of jsonpath as described by Steffen Göessner.
State of this library
This library is still work in progress, but feel free to use it create issues. It lacks some features and has a few variances from the description.
- The Length funtion: The ability to say
$.length. It will just look for
lengthkey as of now.
- ScriptExpression: The ability to say things like
$sign in the beginning is not compulsory
$..*will not produce the root object itself.
Shout out to JSON-Path-Test-Suite
I have copied a few of the tests from there, I will probably just sub-module the repository if and when the whole test suite is green.
I am using this library to support GCP authentication in the Kubernetes haskell client.
Changelog for jsonpath-hs
v0.3.0.0 - Lots of breaking changes, they come with new features
This release aims to address many deviations from similar libraries in other programming languages, this is thanks to Christoph Burgmer’s json-path-comparison project.
There has also been significant work in codifying JSONPath by the IETF-WG for JSONPath, the draft spec can be acccessed here. This release also aims to adapt some of the ideas from from spec.
As a result there have been significant breaking changes in the types and also small changes in the way JSONPaths are executed.
List of changes:
- Fix compiler warnings and bugs with non-total pattern matches.
- Allow double quoted literals and field accessors.
- Ensure termination when start or end of slice are too big/small.
- Implement slice execution based on IETF draft spec .
- Ensure that a valid JSONPath never fails to execute.
- Drop support for GHC <= 8.2.
- Use megaparsec instead of attoparsec for better error messages.
- Allow escape sequences in key names.
- Allow parsing empty paths.
- Allow spaces arround index selectors.
- Allow selecting keys in unions and allow many union elements.
- Implement ‘and’, ‘or’ and ‘not’ operator support in filters.
- Allow comparison between two singular paths.
- Allow bools and nulls in filters.
- Support and require aeson >= 2
- BreakingChange: Fix typo in
- Fix typo in parser error.
- Remove upper bounds from dependencies, as most of them are quite stable packages.
- Import Data.Semigroup to support GHC 8.
- Add test json files to make sure test sdist compile and runs.
- Start the project.