I have a mind-boggling problem. I have the following String:
[{"Time":0,"HR":0,"Steps":0,"Battery":0,"Screen wake":0,"Do-not-disturb":0,"Charger":0,"Notification":0},{"Time":0,"HR":0,"Steps":0,"Battery":0,"Screen wake":0,"Do-not-disturb":0,"Charger":0,"Notification":0}]
I am trying to convert this to JSONArray in order to add more elements like this:
jsonArrayData = gson.fromJson(string, JSONArray.class);
This is throwing error
Expected BEGIN_OBJECT but was BEGIN_ARRAY at line 1 column 2 path $
I can get my head around what I do wrong ...
JSONArrayfrom theorg.jsonparser? Pick one JSON parser and use it. Create a Java class that models your HR data and have Gson parse your JSON into anArrayListof that type.