Open narciero opened 6 years ago
I totally agree.
Json Path is a powerful tool but the way this implementation displays the subset fields is not quite very useful.
+1 for this feature.
Thanks a lot for the work already put in!
It does support that, just the parser won't allow spaces
"$[a,b]" with no spaces should work
@sdawood I tried your syntax and the results are returned as follows:
[
"1st_value_for_a",
"1st_value_for_b"
"2nd_value_for_a",
"2nd_value_for_b"
"3rd_value_for_a",
"3rd_value_for_b"
]
Instead of each pair separated in its own object.
The no-spaces is a parser Grammer limitation that can be easily fixed in the future. The behavior of the AST evaluation code (the handler function) is responsible for the data shape, also should be revised.
Just FYI, the Jayway JsonPath feature to extract a subset of members from a json object is actually a bug in the Jayway JsonPath parser, see [,] is intersection, not a union operator for field names.
Too bad that very useful feature is threated like a bug )
A feature that the Jayway JsonPath parser has that is very useful is being able to select a subset of fields within a JSON object.
Using the Goessner example here: http://jsonpath.herokuapp.com/, the jsonpath:
$.store.book[*].['category', 'author']
would return all books with only the category and author fields:
It would be great if this library supported this as well. Thanks and great work!