An array is an ordered collection of data elements grouped under one name. In JSON, it uses square brackets, with values separated by commas. section 3.5.2
Think of a pill container: each bucket holds one value, and the whole container lets you handle related values together. A one-dimensional array has one layer of buckets; a two-dimensional array contains smaller arrays. section 3.5.2
Arrays become useful when data needs a shared structure:
- Group several values so operations can apply to the collection as a whole. section 3.5.2
- Keep values of the same data type within an array, such as all strings or all numbers. section 3.5.2 section 3.6
- Nest arrays to represent multiple dimensions, while recognizing that deep nesting can become difficult to interpret. section 3.5.2
- Place arrays inside objects when names are needed to clarify what each collection represents. section 3.5.2
A week of time slots
A one-dimensional array can list the days of the week. A two-dimensional version can store four time slots inside each day, such as Morning, Noon, Evening, and Night. section 3.5.2
[ ["Morning", "Noon", "Evening", "Night"], ["Morning", "Noon", "Evening", "Night"], ["Morning", "Noon", "Evening", "Night"], ["Morning", "Noon", "Evening", "Night"], ["Morning", "Noon", "Evening", "Night"], ["Morning", "Noon", "Evening", "Night"], ["Morning", "Noon", "Evening", "Night"] ]
This nested listing shows one large array made from seven smaller arrays, making the second dimension visible at a glance. section 3.5.2







































