dchester/jsonpath

How to get perticular key value from json

Opened this issue · 0 comments

Hi, I am trying to get perticular key value pair from json.

Example:

{
    "store": {
        "book": [
            {
                "category": "reference",
                "author": "Nigel Rees",
                "title": "Sayings of the Century",
                "price": 8.95,
                "name": {
                    "test":"some name 1"
                }
            },
            {
                "category": "fiction",
                "author": "Evelyn Waugh",
                "title": "Sword of Honour",
                "price": 12.99,
                 "name": {
                    "test":"some name 2"
                }
            },
            {
                "category": "fiction",
                "author": "Herman Melville",
                "title": "Moby Dick",
                "isbn": "0-553-21311-3",
                "price": 8.99,
                "name": {
                    "test":"some name 1"
                }
            },
            {
                "category": "fiction",
                "author": "J. R. R. Tolkien",
                "title": "The Lord of the Rings",
                "isbn": "0-395-19395-8",
                "price": 22.99
            }
        ],
        "bicycle": {
            "color": "red",
            "price": 19.95
        }
    },
    "expensive": 10
}

From this data I want get category and auther key value pair only. I am unable to get any example for that. I also tries $.store.book[?(@.auther,@.category)] but this does not seems to work.