-
Notifications
You must be signed in to change notification settings - Fork 486
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added json_path function #4225
Added json_path function #4225
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me pending Clayton checking doc, great work!
|
||
`json_path` always return a list of values. If the jsonpath expression does not match any values, an empty list is returned. | ||
|
||
> Remember to escape double quotes when passing JSON string literals to `json_path`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's implied, but could we also mention that we can pass the string export of another component directly if it's valid JSON?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do a bit copy/paste from json_encode. Is this enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, LGTM!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some suggestions for the doc
Co-authored-by: Clayton Cornell <[email protected]>
@clayton-cornell thanks, commited. |
* Added json_path function * Add doc note about local.file * Update docs/sources/flow/reference/stdlib/json_path.md Co-authored-by: Clayton Cornell <[email protected]> --------- Co-authored-by: Clayton Cornell <[email protected]>
* Added json_path function * Add doc note about local.file * Update docs/sources/flow/reference/stdlib/json_path.md Co-authored-by: Clayton Cornell <[email protected]> --------- Co-authored-by: Clayton Cornell <[email protected]>
PR Description
This PR add a json_path function to stdlib. See #4171 for use cases.
Which issue(s) this PR fixes
Fixes #4171
Notes to the Reviewer
Coming from https://cburgmer.github.io/json-path-comparison/, I choice github.com/ohler55/ojg. The library is MIT licensed, seems actively maintained and has zero dependencies.
PR Checklist