nerdexam
Cisco

350-401 · Question #1290

Which JSON script is properly formatted?

The correct answer is C. {. The properly formatted JSON script starts and ends with curly braces for an object, containing a key-value pair where the value is another object with correctly formatted key-value pairs inside.

Submitted by skyler.x· Mar 6, 20266.0 Automation

Question

Which JSON script is properly formatted?

Options

  • A"car":[
  • B{
  • C{
  • D[

How the community answered

(23 responses)
  • A
    4% (1)
  • C
    91% (21)
  • D
    4% (1)

Why each option

The properly formatted JSON script starts and ends with curly braces for an object, containing a key-value pair where the value is another object with correctly formatted key-value pairs inside.

A"car":[

This script is improperly formatted because it attempts to define an array following the "car" key, but then lists key-value pairs directly inside the array without enclosing them in curly braces to form objects.

B{

This script is improperly formatted because it starts with double curly braces `{{` which is not a valid JSON root element; JSON must begin with either a single curly brace `{` for an object or a square bracket `[` for an array.

C{Correct

This script is properly formatted JSON because it begins and ends with curly braces, indicating a root object, which contains a key-value pair where the key `car` maps to a nested object containing valid, comma-separated key-value pairs.

D[

This script is improperly formatted because it starts with square brackets `[`, indicating an array, but then places a single key-value pair directly inside the array, which is syntactically incorrect; an array should contain a list of values (objects, strings, numbers, etc.), not direct key-value pairs.

Concept tested: JSON syntax and structure

Source: https://www.json.org/json-en.html

Topics

#JSON syntax#Data serialization

Community Discussion

No community discussion yet for this question.

Full 350-401 Practice