Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have the following json response:
{
"2019-06-01":["recs": 1, "vals": 2],
"2019-06-02":["recs": 1, "vals": 2]
}
I want the result:
2019-06-01, 1, 2
2019-06-02, 1, 2
In the JSONPath I have "$.[*]"
I can get back the values 1,2, but I don't know how to get the date first?
I know it must be something stupid easy, but I've tried all sorts of combinations of things and still can't seem to get it!
TIA.
Frank
It look's like the correct version of your json should be :
{ "2019-06-01":{"recs": 1, "vrec": 2}, "2019-06-02":{"recs": 1, "vals": 2} }
Another issue is that, "2019-06-01" and "2019-06-02" are like column names, not values
Your expected result may require something like :
{ "root":[ {"date":"2019-06-01","recs": 1, "vals": 2}, {"date":"2019-06-02","recs": 1, "vals": 2} ] }
Yah, it's not my API so I don't have any control over it... I can get one day record at a time though, so I guess the best thing is to loop through the days I want data for and pass it as a context variable or something.