I have JSON array that looks like
var data = {
"fields": [{
"firstName": {
"fieldName": "First Name",
"required": true,
"provided": false
}
},
{
"lastName": {
"fieldName": "Last Name",
"required": true,
"provided": false
}
},
{
"email": {
"fieldName": "Email",
"required": true,
"provided": false
}
}
]
}
Further down I am trying to do this:
- Access the
fieldNameof the firstName object. Is there to do that without using the index?
data.fields gives me the array of object. From there onwards, I do not seem to be able to access with the object key.
Also, data.fields[0] gives the whole firstName object but I can't seem to do data.fields[0]["field"] or data.fields[0].field
Thanks.
data.fields gives me the array of object. From there onwards, I do not seem to be able to access with the object key.-data.fields[0].firstName.fieldName