I have following JSON that I'm trying to deserialize.
{
"output-parameters":[
{
"value":{
"array":{
"elements":[
{
"string":{
"value":"cp-100"
}
},
{
"string":{
"value":"cp-101"
}
},
{
"string":{
"value":"cp-100"
}
},
{
"string":{
"value":"cp-101"
}
},
{
"string":{
"value":"cp-100"
}
}
]
}
},
"type":"Array/string",
"name":"Tags",
"scope":"local"
},
{
"value":{
"string":{
"value":"subscribed"
}
},
"type":"string",
"name":"Error",
"scope":"local"
}
]
}
I have created following classes to bind the JSON
public class OutputParameter
{
[JsonProperty(PropertyName = "value")]
public value value { get; set; }
[JsonProperty(PropertyName = "name")]
public string name { get; set; }
}
public class value
{
[JsonProperty(PropertyName = "array")]
public array_ array_ { get; set; }
}
public class array_
{
[JsonProperty(PropertyName = "elements")]
public element[] element { get; set; }
}
public class element
{
[JsonProperty(PropertyName = "value")]
public string value { get; set; }
}
I don't get any error while i'm deserializing it. Also i can navigate through easily.
but when i,m trying to get the value of element[n] (output_parameters[0].value.array_.element[0].value). it returns null.
What is the problem here ?
NOTE : I Just need few values to be taken from JSON. For example I don't need values like "type":"string", "name":"Error", "scope":"local" That's why i created C# classes like this.
