So I got this JSON Array in a variable named jsonObject:
jsonObject = {
"log": [{
"date": "15/09/2016",
"time": "15:35:56",
"temp": "16.0",
"humidity": "95.0"
}, {
"date": "15/09/2016",
"time": "15:35:59",
"temp": "30.0",
"humidity": "61.0"
}, {
"date": "15/09/2016",
"time": "15:36:03",
"temp": "30.0",
"humidity": "60.0"
}]
}
My goal is to iterate over it and place the data in a table and to do this I want the JSON Array as a normal array in Javascript. I have found many code examples on this, but none of them take into account the name of the array in this case "log". Anyone know how I can get rid of the name and just get an array? I could make the JSON array itne a string, substring it and then convert it into a JSON Array again and then convert it to a Array, but it feels very ineffeficent. Perhaps there is a way to create a 2D array of the JSON Array as a string but I don't know how.
jsonObject = {...}
or more likejsonObject = "{...}"
???console.log(typeof jsonObject)
give you? If it isstring
then it is JSON, ifobject
then it's a plain old Javascript object.