So I have this array of JSON objects:
[
{
"columns": [
{
"fields": [
{
"valueFields": [
{
"type": 1,
"fieldName": "prj_Name",
"value": "1A BNL FB e-Powedr basic Balci Reizen",
"valueId": "",
"defaultValue": false,
"baseValue": false,
"mandatoryField": true,
"hasError": false,
"errorMessage": "",
"disabled": false,
"visible": true
}
]
}
]
}
]
}
]
and I would like to Iterate through the Data to do some stuff with it later.
I already tried this :
for (var key in currentObject) {
if (currentObject.hasOwnProperty(key)) {
console.log(key + ': ' + currentObject[key]);
}
}
But it prints every letter separatly in the console, so I guess it isn't right. Do you have any Ideas of what I am doing wrong ?
[EDIT]
I tried to add var currentObject = JSON.parse(Json);
before the for
loop.
I now get this printed 0: [object Object]
How to iterate through the object then ?