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
Related Questions
Can json have duplicate keys?
Learn whether JSON can have duplicate keys, what happens when they occur, and why you should avoid them for data integrity and predictability.
Can json use single quotes?
Find out if JSON can use single quotes. Learn about JSON's strict double-quote requirement and why it differs from JavaScript syntax.
Can json have comments?
Learn whether JSON supports comments and discover workarounds. Understand why standard JSON excludes comments and alternatives like JSON5.
Still have questions?
Can't find the answer you're looking for? Please reach out to our support team.