epv February 2016

Parsing through a json file with multiple nested items Angular

AIOI have this JSON file below, linted by jsonlint.com. I am having a problem identifying the right angular dot down method to get to FirstName.

{{complaints.FileNum}}

Will render: case1

{{complaints.AIO[0].AIO_ID}} 

will render: 3

{{complaints.AIO.CRINVOLVED[0].Firstname}} OR     {{complaints.AIO.CRINVOLVED[0].Firstname}}

will render nothing. Please advise on what I am doing wrong.

{
"AIO": [{
    "ALLEGATIONS": [],
    "CRINVOLVED": {
        "ASSOC_INC_OFF": [],
        "FirstName": "Joe",
        "MiddleName": null,
        "LastName": "Do",
        "DateOfBirth": null,
        "Hired_DT": null,
        "Race": null,
        "Rank": null,
        "District": null,
        "OffDuty": null,
        "Sex": null,
        "Ethnicity": null,
        "OfficerType": null,
        "OIMOnly": null,
        "CompID": null,
        "OFCNUM": 2,
        "AIO_ID": null,
        "BadgeNo": "P12345",
        "Department": null
    },
    "AIO_ID": 3,
    "COMP_ID": 1,
    "OFCNUM": 2,
    "LINK_TYPE": null
}],
"COMP_ID": 1,
"FileNum": "case1",
"Received_DT": "2016-01-21T00:00:00",
"CRORoute_DT": "2015-10-07T00:00:00"
}

Answers


Maxwell Lasky February 2016

You want this I think: complaints.AIO[0].CRINVOLVED.FirstName


Yan Kozlovskiy February 2016

Object.Array[index].Object.field

complaints.AIO[0].CRINVOLVED.FirstName


frishi February 2016

Made a fiddle: https://jsfiddle.net/frishi/nbe9hc32/6/

This should do it:

 {{foo.ASSOC_INC_OFF[0].CRINVOLVED["FirstName"]}}

Post Status

Asked in February 2016
Viewed 3,469 times
Voted 13
Answered 3 times

Search




Leave an answer