What Are the Properties of a Valid JSON?
Quick Reference: Valid JSON Must
- ✓Begin with an object or array []
- ✓Use double quotes for strings
- ✓Separate elements with commas
- ✓Use valid data types only
1. Basic Structure
A valid JSON document must start with either an object (denoted by curly braces ) or an array (denoted by square brackets []). This is a fundamental rule that forms the foundation of JSON structure.
Valid Examples:
// Valid object
{
"name": "John Doe",
"age": 30
}
// Valid array
[
"apple",
"banana",
"orange"
]
2. Data Types
JSON supports six specific data types. Understanding these types is crucial for working with JSON:
String
Must be enclosed in double quotes
"Hello, World!"
Number
Integer or floating-point
42, 3.14, -1
Boolean
True or false values
true, false
Null
Represents no value
null
Array
Ordered list of values
["red", "green", "blue"]
Object
Collection of key-value pairs
{"key": "value"}
3. Common Validation Rules
Property Names
- Must be enclosed in double quotes
- Must be unique within an object
- Can contain any valid string characters
String Values
- Must use double quotes (not single quotes)
- Special characters must be escaped with backslash
- Unicode characters are allowed
Numbers
- Can be integer or floating-point
- Scientific notation is allowed (e.g., 1e-10)
- Leading zeros are not allowed
- Plus sign (+) is not allowed
4. Common Mistakes to Avoid
- ✗Using Single Quotes
Always use double quotes for strings and property names
- ✗Trailing Commas
JSON doesn't allow a comma after the last element
- ✗Using Comments
JSON format doesn't support comments
- ✗Unquoted Property Names
Property names must be enclosed in double quotes
Need to Validate Your JSON?
Use our free JSON validator and formatter to check if your JSON is valid and properly formatted.
Try JSON Tools Now