Toi Nguyen
Toi Nguyen

Reputation: 473

Json path for find key by regex

I have a json data:

{
  "id": 101,
  "type": "test",
  "data": {
    "value1": "dog",
    "name1": "A",
    "value2": "pig",
    "name2": "B",
    "value3": "cat",
    "name3": "C"
  }
}

I want to apply JSONPath to it to only return results with key have prefix = value* in data.

The expected result is :

[
  {
    "dog",
    "pig",
    "cat",
  }
]

Which way to filter json key by regex in JSONPath expression?

Upvotes: 3

Views: 608

Answers (1)

Happs
Happs

Reputation: 125

Is you json dta is fix, if yes then you can go for below without using regex

$.data.[value1,value2,value3]

Upvotes: 1

Related Questions