I have the following JSON that I want to parse into C#. I am trying to avoid outside libraries but if I have to I can use them. Right now I am using the JavaScriptSerializer method of parsing from a JSON file following the answer on another stackoverflow question Unfortunately I can have any number of the objectX items under Resources and they all have different names. Is there another way of doing this?
{
"FormatVersion" : "2010-09-09",
"Description" : "My JSON Description",
"Parameters" : {
"Product" : {
"Description" : "Product name",
"Type" : "String",
"Default" : "cs42"
},
"DifferentObjectSize" : {
"Description" : "DifferentObjectSize",
"Type" : "String",
"Default" : "large"
},
"ObjectSize" : {
"Description" : "Worker size",
"Type" : "String",
"Default" : "medium"
}
},
"Resources" : {
"differentobject" : {
"Type" : "MyType",
"Properties" : {
"InstanceType" : { "Ref" : "DifferentObjectSize" }
}
},
"object1" : {
"Type" : "MyType",
"Properties" : {
"InstanceType" : { "Ref" : "ObjectSize" }
}
},
"object2" : {
"Type" : "MyType",
"Properties" : {
"InstanceType" : { "Ref" : "ObjectSize" }
}
},
"object3" : {
"Type" : "MyType",
"Properties" : {
"InstanceType" : { "Ref" : "ObjectSize" }
}
},
"object4" : {
"Type" : "MyType",
"Properties" : {
"InstanceType" : { "Ref" : "ObjectSize" }
}
},
}
}