Basic Array Syntax
A JSON array is a comma-separated list of values enclosed in square brackets: [1, 2, 3] or ["apple", "banana"]. Arrays can contain any JSON value type — including other arrays and objects. Mixed-type arrays are syntactically valid, though most APIs return homogeneous arrays.
Arrays of Objects — The Most Common Pattern
The most common JSON API pattern is an array of objects — a list of items where each item is a structured record. This pattern appears in search results, list endpoints, and any response returning multiple entities.
Nested Arrays
Arrays can contain other arrays, creating multi-dimensional structures. GeoJSON represents polygon coordinates as an array of arrays of coordinate pairs. Deep nesting can make JSON hard to read; formatting tools that visualize the nesting depth are helpful.
Empty Arrays and Pagination
An empty array [] is a valid, meaningful value that communicates 'no items' — different from null. APIs typically return empty arrays for list endpoints with no results. Large result sets are paginated — the response includes the current page's array plus metadata.
Arrays are the workhorse of JSON data representation. Master iterating arrays of objects and handling empty/paginated responses to handle the vast majority of real-world API response shapes.