Nested Arrays

Total Post:113

Points:791

JSON 
 283  View(s)
Ratings:
Rate this:

Nested Arrays in JSON Objects ?

  1. Re: Nested Arrays

    Arrays as JSON Objects :

    JSON array are almost the same as arrays in JS. Values must be string, number, object, array, boolean or null type in JSON array. 

    Example : 

    [ "Allahabad", "Kanpur", "Varansi" ]
    

    Array values by using a for-in loop: 

    for (i in myObj.city) { 
        x += myObj.city[i];
    }

    Nested Arrays in JSON Objects: 

    myObj = { 
        "name":"Prakash",
        "age":19,
        "city": [
            { "name":"Allahabad", "models":[ "Sangam"] },
            { "name":"Kanpur", "models":[ "Industrial"] },
            { "name":"Varansi", "models":[ "Devnagari" ] }
        ]
     }
    delete myObj.city[1];    //Delete array 

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.