This is my JSON file:
"charts": {
"system_voltage": {
"enabled": true,
"title": "System Voltage",
"xaxis_label": null,
"yaxis_label": null,
"y_min": 0,
"y_max": 18,
"status": false
},
"temperature1": {
"enabled": true,
"title": "Box1 Temp",
"xaxis_label": null,
"yaxis_label": null,
"y_min": -30,
"y_max": 50,
"status": false
},
"temperature2": {
"enabled": true,
"title": "Amb Temp",
"xaxis_label": null,
"yaxis_label": null,
"y_min": -30,
"y_max": 50,
"status": true
}, ...
my original approach was doing it this way inside the for loop:
JSONObject objSysVoltage = chartss.getJSONObject("system_voltage");
but what if I have 100 of them or more?
Each object inside charts is unique. How can I loop through a JSONObject and assign each object to a JSON array without doing it manually?
JSONObject chartss = objData.getJSONObject("charts");
for(int i = 0; i < chartss.length(); i++) {
//what goes here??
}