Which JSON syntax below is valid?
Choose an answer
Tap an option to check your answer.
Correct answer: {■€switch■€: {■€name■€: ■€dist1■€, ■€interfaces■€: [■€gig1■€, ■€gig2■€, ■€gig3■€]}}.
Why this is the answer
The correct option demonstrates valid JSON syntax. JSON objects are enclosed in curly braces {}. Key-value pairs within an object are separated by a colon :, and pairs are separated by commas ,. Keys and string values must be enclosed in double quotes ". Arrays are enclosed in square brackets []. In this correct option, "switch" is a key whose value is another JSON object containing "name" and "interfaces" keys. "interfaces" has an array of strings as its value. The first incorrect option uses incorrect characters (■€) instead of double quotes for keys and string values. The second incorrect option uses forward slashes / instead of double quotes for keys and string values. The fourth incorrect option uses single quotes ' for keys and string values, which is not valid JSON, and uses parentheses () for an object, which is incorrect; objects must use curly braces {}.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed