joshbuddy/jsonpath

Selecting multiple keys/values

Closed this issue ยท 8 comments

Hi @Skarlso not sure if this is a bug per se, but I can't seem to get this to work (even on jsonpath.com) but can on other evaluators.

JSON

{
    "store": {
        "book": [
            {
                "category": "reference",
                "author": "Nigel Rees",
                "title": "Sayings of the Century",
                "price": 8.95
            },
            {
                "category": "fiction",
                "author": "Evelyn Waugh",
                "title": "Sword of Honour",
                "price": 12.99
            }
        ]
}

JSONPath

$.store.book[*]['category', 'author']

Desired outcome

[
   {
      "category" : "reference",
      "author" : "Nigel Rees"
   },
   {
      "category" : "fiction",
      "author" : "Evelyn Waugh"
   }
]

Hey dude. Thanks for pinging me. I'm on vacation until Friday, I'll take a peak then and see what I can do. :-)

@Skarlso no worries man, there's no rush as I've currently coded around it. Just a future improvement - potentially.

Enjoy your break!

@NDuggan thanks man. I'm back. Going to take a look at things. :)

Would like this feature. To be able to provide a list of fields in the format ['field1', 'field2'] on an object and get those fields from the JSON object.

๐Ÿ‘ I'll do this. Sorry for the long ass delay. I was bogged down a lot of things.

Sure, if you can figure out how to do this with Jsonpath, by all means! :)

I remember looking at it briefly. Unfortunately it's not a trivial thing to do. And probably requires some re-writing of the parsing rules.