https://github.com/sidmishraw/jsonpath-syntax-validator
Validates the syntax of a JSON path expression.
https://github.com/sidmishraw/jsonpath-syntax-validator
jsonpath jsonpath-parser jsonpath-syntax
Last synced: 3 months ago
JSON representation
Validates the syntax of a JSON path expression.
- Host: GitHub
- URL: https://github.com/sidmishraw/jsonpath-syntax-validator
- Owner: sidmishraw
- License: apache-2.0
- Created: 2019-06-05T06:28:10.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2023-12-05T22:07:11.000Z (about 2 years ago)
- Last Synced: 2025-09-08T05:48:12.325Z (5 months ago)
- Topics: jsonpath, jsonpath-parser, jsonpath-syntax
- Language: Java
- Size: 20.5 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# JSON Path expression syntax validation
This project uses the JSON Path expression parsing logic mentioned in [Stefan Goessner's article](https://goessner.net/articles/JsonPath/).
I make use of parts of the code from original JSON path implementation in JS found [here](https://code.google.com/archive/p/jsonpath/).
## Usage
```java
class Example {
public static void main(String[] args) {
JsonPathValidator validator = new BasicJsonPathValidator();
Assert.assertTrue(validator.validate("$.as[?(@.name == 'samba')]"));
Assert.assertFalse(validator.validate("a['??kangaroo \"A\"'][??(@.name == 'a')].value"));
}
}
```
`JsonPathValidator` is an interface that has a basic implementation `BasicJsonPathValidator`. If required other sophisticated validators can be added to this library.
> Note: This library doesn't really evaluate the path against a JSON object, this is strictly pre-evaluation phase syntax check.
## Dependencies
- Project Lombok
- Maven
- Slf4j
- Logback
## References
[1] https://goessner.net/articles/JsonPath/
[2] https://code.google.com/archive/p/jsonpath/