JSON Structure for List of Objects JSON Structure for List of Objects json json

JSON Structure for List of Objects


The second is almost correct:

{    "foos" : [{        "prop1":"value1",        "prop2":"value2"    }, {        "prop1":"value3",         "prop2":"value4"    }]}


The first one is invalid syntax. You cannot have object properties inside a plain array. The second one is right although it is not strict JSON. It's a relaxed form of JSON wherein quotes in string keys are omitted.

This tutorial by Patrick Hunlock, may help to learn about JSON and this site may help to validate JSON.


As others mentioned, Justin's answer was close, but not quite right. I tested this using Visual Studio's "Paste JSON as C# Classes"

{    "foos" : [        {            "prop1":"value1",            "prop2":"value2"        },        {            "prop1":"value3",             "prop2":"value4"        }    ]}