An array [] of objects {} containing key-value pairs separated by a colon :
[
{
"dish": "Linguine with Pesto",
"level": "Beginner",
"ethnicity": "Italian",
"description": "A favorite from the Ligurian coast made when basil is in season.",
},
{
"dish": "Pad Thai",
"level": "Intermediate",
"ethnicity": "Thai",
"description": "A tangy stir fry from Thailand."
},
]
The labels ("keys") have to be strings, but the contents ("values") can also be numbers, arrays, or objects.
[
{
"dish": "Linguine with Pesto",
...
"cookingTimeInMinutes": 30,
"ingredients": ["basil", "olive oil", "linguine", "pine nuts", "garlic"]
},
{
"dish": "Pad Thai",
...
"cookingTimeInMinutes": 25,
"ingredients": ["shrimp", "peanuts", "egg", "sprouts"]
},
]
You can refer to images by setting a label to a string containing a URL path to an uploaded image.
[
{
"dish": "Linguine with Pesto",
...
"image": "https://example.com/linguine_con_pesto.jpg"
},
{
"dish": "Pad Thai",
...
"image": "https://example.com/pad_thai.jpg"
},
]
Unlike English grammar, trailing commas go after quotes.
value", ✅
value," ❌
❌ Trailing commas with no entry after them can cause errors.
[
{
"dish": "Linguine with Pesto",
"level": "Beginner", // BAD
},
{}.
"dish": "Pad Thai",
"level": "Intermediate", // BAD
}, // BAD
]
✅ Eliminate hanging commas instead:
[
{
"dish": "Linguine with Pesto",
"level": "Beginner"
},
{
"dish": "Pad Thai",
"level": "Intermediate"
}
]
/