Very much like a normal array, but it’s like inception [ {object inside object(array) } ]
You may wonder , what is an array?
An array is a data structure which can store multiple items and that item can be accessed by using the index number!
Let’s start with creating an array!
Now that we know the syntax of creating a new array , let’s try creating a javascript object ,which is also called JSON.
Javascript Object notation is used to represent the data in a structured format based on Javascript object syntax.
Now that we know how to create JSON and access its data, Next step would be to implement this idea where we combine arrays and json together!
Let’s modify the array and re-write it with json objects inside it.
Here there are 5 objects inside the array. If we want to access the object containing Java, we use the index number 1 as we use in an array. Next we have stored the whole object inside a variable object. Moving on, to access the value from the key “ Java” , the syntax is given on line 9. To access the key of an object, we can use the inbuilt method as shown in line 13.
Top comments (0)