350-401 · Question #1296
Which JSON script is properly formatted?
The correct answer is D. {. A properly formatted JSON script must start and end with either curly braces {} for an object or square brackets [] for an array.
Question
Which JSON script is properly formatted?
Options
- A["frames":{
- B{[
- C["Restaurant":
- D{
How the community answered
(29 responses)- A3% (1)
- C7% (2)
- D90% (26)
Why each option
A properly formatted JSON script must start and end with either curly braces `{}` for an object or square brackets `[]` for an array.
`["frames":{{` is syntactically incorrect because square brackets denote an array, which contains elements, not key-value pairs directly with colons.
`{{[` is an invalid combination of opening JSON delimiters; a JSON document must start with either a single `{` or `[`.
`["Restaurant":` is syntactically incorrect for an array, which should contain values separated by commas, not key-value pairs with colons without being within an object.
A valid JSON document can be either an object, starting and ending with curly braces `{}`, or an array, starting and ending with square brackets `[]`. `{{` indicates the beginning of a nested object or an invalid structure if not properly closed, but it is the only option that correctly starts a common JSON structure (an object).
Concept tested: JSON basic syntax
Source: https://www.json.org/json-en.html
Topics
Community Discussion
No community discussion yet for this question.