Jsonpath - filter at child level to get parent att

2019-05-10 01:52发布

问题:

Is there any way to extract "a" value by filtering on "d" in the following json?

[
  {
    "a":1,
    "b":{ "c":11,"d":12 }
  },

  {
    "a":2,
    "b":{ "c":21,"d":22}
  }
]

回答1:

$..[?(@.b.d == 12)].a

above expression can solve this



标签: jsonpath