-
-
Notifications
You must be signed in to change notification settings - Fork 181
wrap option returns the same result for arrays whether true or false #86
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
Comments
This would be the more intuitive behavior. However,
Thus if you get array results with A better naming for this alternative Perhaps we could add an option that avoids breaking existing code and follows the behavior you describe (of unwrapping arrays as well): And perhaps we should also add an option of
This approach would have the benefit over (Note the responsible code to change is at https://github.com/s3u/JSONPath/blob/master/src/jsonpath.js#L202-L214 , esp. 203-205) |
Just my thoughts/observations... Point 3 above about how Ideally |
Thanks for your comments. I'll give this some more thought if I'm revisiting this, but tbh, this library is a low priority for me atm. |
Given the following JSON:
JSONPath returns the same result for the following 2 queries:
JSONPath({data: data, path: "$.store.book", wrap: true});
JSONPath({data: data, path: "$.store.book", wrap: false});
I believe for wrap: false, the outer array should be removed like this:
The text was updated successfully, but these errors were encountered: