JSON Syntax

Can json start with array?

Yes, valid JSON can start with an array as the root element. While many examples show JSON starting with an object, arrays are equally valid top-level structures. A JSON array as the root is commonly used when returning multiple records from an API, such as a list of users or products. For example, a valid JSON array looks like [{"id": 1}, {"id": 2}]. Some older JSON parsers had security vulnerabilities with top-level arrays, leading to recommendations to always use objects as roots. Modern parsers have fixed these issues, making top-level arrays safe and widely accepted. Whether to use an array or object as the root depends on your data structure and API design needs.
Last updated: December 23, 2025

Still have questions?

Can't find the answer you're looking for? Please reach out to our support team.