JSON Basics
What is the difference between {} and [] in JSON?
In JSON, curly braces {} represent objects containing key-value pairs, while square brackets [] represent arrays containing ordered lists of values. Objects use keys as identifiers, like {"name": "John", "age": 30}, where each value is accessed by its key. Arrays contain indexed values without keys, like ["apple", "banana", "cherry"], accessed by numeric position. Objects are best for representing entities with named properties, while arrays are ideal for collections of similar items. Objects require string keys in double quotes, whereas arrays contain comma-separated values of any type. You can nest objects within arrays and vice versa for complex structures. Use our JSON Editor at jsonconsole.com/json-editor to visualize the difference in tree view, making it clear when to use objects versus arrays for your data structure needs.
Last updated: December 23, 2025
Related Questions
What is JSON?
Learn what JSON is - a lightweight data interchange format used for APIs, configuration files, and data storage. Understand JSON basics and its importance in modern web development.
What are JSON data types?
Learn about JSON data types including strings, numbers, booleans, null, objects, and arrays. Understand how to use each type in your JSON structures.
What is JSON used for?
Discover what JSON is used for including APIs, configuration files, data storage, and web applications. Learn JSON's role in modern development.
Still have questions?
Can't find the answer you're looking for? Please reach out to our support team.