I have a JSON object like
{
"endtime": 1446188340,
"interval": 60,
"metrics": {
"heartrate": {
"values": [
88,
92,
88,
89,
86,
84,
82,
86,
97,
77,
81,
87,
83,
101,
96,
97,
123,
123,
127,
127,
127,
130,
134,
133,
129,
126,
121,
137,
141,
149,
144,
120,
104,
102,
100,
107,
116,
107,
98,
97,
115,
107,
106,
98
]
}
},
"starttime": 1446102000,
"timezone_history": [
{
"offset": -7,
"start": 1446102000,
"timezone": "America\/Los_Angeles"
}
]
}
How would I get an array of the heartrate data under "values"?
If I print:
JSONObject a = new JSONObject(obj.getJSONObject("metrics").getJSONObject("heartrate"));
I just get:
{}
And it seems that JSONArray is not the right thing to use either. I just want to get an array of doubles that I can work with. Thank you!