Formatowanie JSON i walidator składni
Waliduj JSON (opcjonalnie JSONP) i sprawdzaj błędy składni.
Treat as JSONP when JSONP is detected
- Safe
- Processing runs on your device, so input/output is not sent anywhere.
JSON Syntax Rules
Basic rules
- Wrap the document in { } braces.
- Each entry is a key/value pair joined by :.
- Use , between pairs (but not after the last pair).
- key must be wrapped in " ".
- value can be multiple types (strings must be wrapped in " ").
{
"id": 123,
"name": "Taro Yamada",
"registered": true,
"nickname": null,
"skills": [
"html",
"JavaScript"
],
"contact": {
"phone": "0X0-123-456",
"email": "taro@xxxxx.jp"
}
}Allowed types for value
| Type | Example | Notes |
|---|---|---|
| String | "name": "Taro Yamada" | Must be wrapped in " " (single quotes are not allowed). |
| Number | "id": 123 | NaN and Infinity are not allowed. |
| Boolean | "registered": true | Only lowercase true / false. |
| null | "nickname": null | Only lowercase null. |
| Array | "skills": ["html", "JavaScript"] | Array elements can be string, number, boolean, null, array, or object. |
| Object | "contact": { "phone": "0X0-123-456", "email": "taro@xxxxx.jp" } | Objects can be nested. |
Note: JSON has no undefined type.
Patterns
Array
Inside [ ], you can put elements of different types.
["text", 123, true, false, null]You can also include objects as elements.
[
{
"id": 1001,
"name": "Steve Jobs"
},
{
"id": 1002,
"name": "Bill Gates"
}
]Object
Inside { }, values can be any allowed type.
{
"id": 123,
"name": "Taro Yamada",
"registered": true,
"nickname": null
}You can nest objects.
{
"id": 123,
"name": "Taro Yamada",
"contact": {
"phone": "0X0-123-456",
"email": "taro@xxxxx.jp"
}
}You can also put arrays in objects.
{
"id": 123,
"name": "Taro Yamada",
"skills": [
"html",
"JavaScript"
]
}Common mistakes
Missing quotes around the key
Keys must be wrapped in " ". Fix id on line 2 to "id".
1{
2 id: 123,
3 "name": Taro Yamada
4}Missing quotes around a string value
String values must be wrapped in " ". Fix Taro Yamada on line 3 to "Taro Yamada".
1{
2 "id": 123,
3 "name": Taro Yamada
4}Invalid quotes for string values
String values cannot be wrapped in single quotes. Fix 'Taro Yamada' on line 3 to "Taro Yamada".
1{
2 "id": 123,
3 "name": 'Taro Yamada'
4}Trailing comma
The last key/value pair must not end with ,. Fix "Tokyo", on line 4 to "Tokyo".
1{
2 "id": 123,
3 "name": "Taro Yamada",
4 "address": "Tokyo",
5}