var esResponse = {
"aggregations": {
"offerId": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [{
"key": "F1A2LqSYD3u",
"doc_count": 9,
"os": {
"doc_count_error_upper_bound": 0,
"sum_other_doc_count": 0,
"buckets": [{
"key": "Desktop",
"doc_count": 6,
"campaignClick": {"value": 6.0},
"offerClick": {"value": 6.0},
"revenue": {"value": 0.0}
}, {
"key": "Mobile",
"doc_count": 3,
"campaignClick": {"value": 4.0},
"offerClick": {"value": 4.0},
"revenue": {"value": 0.0}
}]
}
}]
}
}
};
Notice the multiple buckets in the "os" aggregation.
The parsing breaks when the response is as follows:
Notice the multiple buckets in the "os" aggregation.