PDA

View Full Version : jsonreader: how to get the totalProperty from a nested JSon value?



jamesnpope
9 Oct 2011, 4:27 AM
Hi,

How can I define the totalProperty config value of my Jsonreader to use a value from my JSon response that is nested a few levels down? If you look at the JSON response below, I need the totalProperty value to be taken from queries/request/totalResults...

JSON response:
{
"queries": {
"request": [{
"totalResults": "87200"
}]
},
"items": [
{"title": "The title"},
{"title": "The title"}
]
}

Thanks in advance,

James

jamesnpope
9 Oct 2011, 4:29 AM
Found it... :)

totalProperty: 'queries.request[0].totalResults'

evant
9 Oct 2011, 4:51 AM
That works. For more complicated stuff a function would work too.