Siddharth Thakor
Siddharth Thakor

Reputation: 156

Access complex Json file with Nested Array

I am facing a problem while fetching the particular array;

my json file

Upvotes: 1

Views: 66

Answers (1)

Shishir Arora
Shishir Arora

Reputation: 5923

Loop over object and print

var o = {
    "Healthcare/Medical":
    Array(167),

        "Personal Care":
    Array(88),

        Miscellaneous_Services:Array(340),

        General_Merchandise:Array(110),

        Home_Improvement:Array(292)
};

Object.keys(o).forEach((k)=>{
    console.log(k);
    o[k].forEach((e)=>{
        console.log(`-id[${e.id}]`);
    });
});

Upvotes: 1

Related Questions