What Is a JSON Array? Standard Lists and Formats
Quick Summary
A JSON array is an ordered list of values enclosed in square brackets ([]) with values separated by commas.
Deep Dive: What is a JSON Array?
While JSON objects ({ }) are perfect for mapping specific keys to values, JSON Arrays are optimized for managing ordered lists of elements. Represented as text wrapped in square brackets [ ], a JSON array holds a sequence of values that are indexed starting at 0.
["Astro", "Tailwind", "TypeScript"]
Allowed Types in JSON Arrays
An array does not contain key/value pairs. Instead, it contains a simple list of values separated by commas. Each value can be any valid JSON data type:
- Strings:
["Apple", "Banana", "Cherry"] - Numbers:
[200, 404, 500] - Booleans:
[true, false, true] - Nulls:
[null, null] - JSON Objects: A collection of objects is highly standard for database queries:
[ {"name": "Alice", "score": 95}, {"name": "Bob", "score": 88} ] - Nested Arrays (Multi-dimensional):
[[1, 2], [3, 4]]
Core Differences: Objects vs. Arrays
Understanding the difference between objects and arrays is vital for drafting correct databases schemas:
| Metric | JSON Object ({ }) | JSON Array ([ ]) |
|---|---|---|
| Structure | Unordered key-value records | Ordered, indexed sequence |
| Primary Identifier | Named double-quoted String keys | Numeric indexing (0, 1, 2…) |
| Ideal For | Modelling a single descriptive entity | Holding data matrices or lists of items |
Analyzing Large JSON Arrays
When debugging long API outputs that return lists of objects, viewing raw code gets extremely tiring.
Using an online rendering utility like our JSON Viewer transforms long arrays of objects into clean, expandable collapsible paths, letting you search indexes or copy paths with a click.
Frequently Asked Questions
Can a JSON array contain mixed value types?
Yes. Unlike strongly-typed languages, a standard JSON array can contain a mixture of strings, numbers, objects, and null values in the same list. However, keeping arrays homogeneous is recommended for easier programmatic parsing.
Need to work with JSON right now?
Check out our 100% private, fast, browser-based tools.