Home  >  Forum  >  Angular
Post New Query

Problem with the output of the Nested JSON



Asked on March 30, 2020

 I have a Nested JSON and I want to output it... Can you guys help me with this, please?

I can output the json susa, how do I output mandantKagAccountEntity?


// Nested JSON

{
    "success": true,
    "susa": [
        {
            "accountlinevaluesId": 1,
            "accountlineId": 1,
            "mandantKagId": 660,
            "mandantAccountsId": 1,
            "period": "7",
            "accountNumber": 27,
            "name": "EDV-Hardware/Software",
            "amount": 55.16859,
            "mandantKagAccountEntity": {
                "mandantKagId": 660,
                "mandantId": 1,
                "kagNumber": 2000,
                "kagText": "A. I. 1. EDV-Software"
            }
        },
] }
// test.component.ts

private loadData() {
    const yearString = this.year ? `${this.year}` : `${new Date().getFullYear()}`;
    this.balanceListService.getDataForAllMonth(yearString).subscribe(
      (resp: any) => {
        const data = resp.success ? resp.susa : null;
        if (null !== data && data) {
         .... }
}
}



Replied on March 31, 2020
Try

let jsonArr = resp.susa;

let row1 = jsonArr[0];

data = row1.mandantKagAccountEntity;

console.log(data)



Write Answer








©2020 concretepage.com | Privacy Policy | Contact Us