feat(p/json): JSON path support
Description
Implemented a feature that parses JSONPath expression using a state machine and extracts data matching the specified path from the input JSON data.
JSONPath is an expression used to select and filter specific data within a JSON data. This implementation supports the basic functionalities of JSONPath.
Here's a table summarizing the supported JSONPath features now:
| Symbol | Description | Example |
|---|---|---|
Root Object($) |
Represents the root object of the JSON. All paths start with this symbol | $.store.book[0].title |
Wildcard(*) |
Selects all elements of any object or array. | $.store.* |
Subscript Operator([]) |
Selects a specific element of an array or object using an index or a key. | $.store.book[0] |
Deep Scan(..) |
Selects the specified property regardless of the depth in the JSON. | $..price |
Slice Operator(:) |
Selects elements within a range in an array. | $.store.book[0:2] |
Currently, This implementation focuses on the basic functionality of JSON path expressions to prevent the size of PR is bigger. So, the filter expressions(?(@)) are not implemented yet. but this feature will be added with complex filtering and built-in functions.
I expect, with this JSONPath parser, users can easily extract and utilize desired information from within JSON data.
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
:loudspeaker: Thoughts on this report? Let us know!
Hello @notJoon . Some CI tests from Sept. 3 failed. Maybe merge master again to see if they pass?
Hello @notJoon . Some CI tests from Sept. 3 failed. Maybe merge master again to see if they pass?
It causes an unknown panic, so I'll leave it in draft until I resolve it.
Only 3 failed tests this time :-) .
I think the "examples/fmt" failure is easy to fix. "Some gno files are not formatted, please run 'make fmt'."
Removed the review/triage-pending label because the author converted this PR to Draft status. When Draft status is removed, we will add the label again.
Closing for cleanup on old PRs