350-401 · Question #37
Which JSON syntax is valid?
The correct answer is C. {"switch":{"name":"dist1′′,"interfaces":["gig1′′,"gig2′′,"gig3"]}}. JSON Syntax Explained Option C is correct because it follows all valid JSON rules: it uses double quotes for all keys and string values, uses curly braces {} for objects, uses square brackets [] for arrays, and properly nests the inner object with correct comma-separated key-valu
Question
Which JSON syntax is valid?
Options
- A{"switch":"name":"dist1′′,"interfaces":["gig1′′,"gig2′′,"gig3"]}
- B{'switch':('name':'dist1′,'interfaces':['gig1′,'gig2′,'gig3'])}
- C{"switch":{"name":"dist1′′,"interfaces":["gig1′′,"gig2′′,"gig3"]}}
- D{/"switch/":{/"name/":"dist1′′,/"interfaces/":["gig1′′,"gig2′′,"gig3"]}}
How the community answered
(27 responses)- B7% (2)
- C89% (24)
- D4% (1)
Explanation
JSON Syntax Explained
Option C is correct because it follows all valid JSON rules: it uses double quotes for all keys and string values, uses curly braces {} for objects, uses square brackets [] for arrays, and properly nests the inner object with correct comma-separated key-value pairs.
Why the others are wrong:
- Option A is missing the curly braces
{}around the nested object -"name":"dist1"is just floating inside the outer object without being wrapped in its own object structure - Option B uses single quotes instead of double quotes (JSON requires double quotes), and uses parentheses
()instead of curly braces{}for the nested object - Option D uses forward slashes (
/) around key names, which is not valid JSON syntax at all - keys must simply be enclosed in double quotes with no extra characters
Memory Tip: Think of JSON as being very strict and picky - it only accepts double quotes (never single), uses {} for objects and [] for arrays, and never uses special characters like slashes in key names. A common exam trap is substituting single quotes or parentheses, which are valid in Python but not in JSON.
Topics
Community Discussion
No community discussion yet for this question.