How to handle when REST service response is returned as Json Array: for e.g:
[{"boolField":true,"intField":991, "StringField":"SampleString"},
{"boolField":false, "intField":998, "StringField": "SampleString2"}]";
All the blogs & examples I have seen didn't deal with the scenario mentioned above. For example, I went through http://goessner.net/articles/JsonPath/ expression syntax, but couldn't locate the solution.
For example the following json, if I want to get all the authors, I can use $.store.book[*].author or $..author
{ "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
}]}
}
However, if the REST service response is returned like below, then how to get all authors from the list
[
{ "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
}
]