問題 ccnp-350-401-topic-1-question-1064・第3版

問題

JSONとして正しく記述されているものはどれか。

  1. A 
    [
      "Plates": {
        [
        "use":"salad"
        "size":"small"
        "shape":"round"
        }
      ]
    ]
    

    候補A

  2. B 
    ["Auto": {
      "maker": "Plymouth",
      "color":"green",
      "year":"1970",
      }
    ]
    

    候補B

  3. C 
    {
      "furniture": [
        {
          "type":"Sofa",
          "material":"cloth",
          "color":"blue"
        }
      ]
    }
    

    候補C

  4. D 
    [ "Lodging":
      {
        "type":motel,
        "location": Main Street,
        "contact":348-059-6776
      }
    ]
    

    候補D

正解:C

理由

Cはオブジェクトの名前furnitureへ配列を対応させ、配列内のオブジェクトの3要素をカンマで区切っている。すべての括弧と引用符も対応する。

選択肢ごとの説明

A.
[
  "Plates": {
    [
    "use":"salad"
    "size":"small"
    "shape":"round"
    }
  ]
]

候補A

配列内にPlatesの名前と値の組を直接置き、内側の括弧も対応していない。use、size、shapeの要素間へ区切りのカンマも必要になる。

B.
["Auto": {
  "maker": "Plymouth",
  "color":"green",
  "year":"1970",
  }
]

候補B

配列へAutoの名前と値の組を直接置いている。最後のyearの値の後のカンマもJSONの構文へ合わない。

C.
{
  "furniture": [
    {
      "type":"Sofa",
      "material":"cloth",
      "color":"blue"
    }
  ]
}

候補C

furnitureの値として配列を持ち、配列内のオブジェクトの三要素をカンマで区切る。すべての括弧と二重引用符が対応している。

D.
[ "Lodging":
  {
    "type":motel,
    "location": Main Street,
    "contact":348-059-6776
  }
]

候補D

配列へLodgingの名前と値の組を直接置いている。motelやMain Streetなどの文字列には二重引用符も必要になる。

お問い合わせ

演習する →