I have the following JSON:
{
"responseHeader":{
"params":{
"facet":"true",
"fl":"city",
"facet.mincount":"1",
"indent":"on",
"start":"0",
"q":["*:*",
"*:*"],
"wt":"json",
"rows":"12"}},
"response":{"numFound":1,"start":0,"docs":[
{"city":"lathum"}]
},
"facet_counts":{
"facet_fields":{
"hasphoto":[
"true",61,
"false",5],
"hasvideo":[
"false",51,
"true",15],
"rating_rounded":[
"0.0",62,
"10.0",3,
"8.0",1]},
"facet_ranges":{}}}
I wonder if it's possible to select a value based on a property name, in my case, I want to select how many of hasphoto have the value true, which would be 61.
Please note that the true value does not necessarily have to be the first listed under hasphoto, true and false are sorted by number of occurences.
I want to get the value directly without having to loop through it....is that possible?
I tried:
response.facet_counts.facet_fields['hasphoto']['true']
and
response.facet_counts.facet_fields.hasphoto['true']
But both return undefined.