java - JsonPath - how to read attributes from different level -
i try use jsonpath extract values attributes @ different levels of json object.
here's object:
{ "a": [ { "b": "0", "c": "1", "d": { "e" : "2", "f" : "3", } }, { "b": "4", "c": "5", "d": { "e" : "6", "f" : "7", } } ] } and extract in same time b , e values
to b, easy : $.a[*].b
to e, easy : $.a[*].d.e
to b , c, easy using bracket-notated children operator : $.a[*]['b', 'c']
but b , e in same time, don't correct expression. expect have :
[ { "b":"0", "e" : "2"}, { "b":"4", "e" : "7"} ] does have correct expression?
thanks
e.
use expression: $.a.[b,e]
notice dot between a , [b,e] tell needs search children of a.
Comments
Post a Comment