Use the following classes:
public class Value
{
public string Code { get; set; }
public string Description { get; set; }
public bool IsSet { get; set; }
}
public class RootObject
{
[JsonProperty("Booking")]
public Value Value { get; set; }
public int Nr { get; set; }
}
and then deserialize your JSON string like this:
var test = JsonConvert.DeserializeObject<List<RootObject>>(json);
The JSON string needs to be unescaped:
[
{"value":{"code":"MO","description":"Monday","isSet":false},"nr":1},
{"value":{"code":"TU","description":"Tuesday","isSet":true},"nr":2}
]
Also the issue with the value is the double quotes. Remove them, and the deserialization works fine.
Update
If you do not want to manipulate the JSON string you can deserialize it twice. For this, I changed the classes like follows:
public class Value
{
public string Code { get; set; }
public string Description { get; set; }
public bool IsSet { get; set; }
}
public class RootObject
{
public string Value { get; set; }
public int Nr { get; set; }
}
public class ResultRootObject
{
public Value Value { get; set; }
public int Nr { get; set; }
}
Then I could deserialize it to ResultRootObject:
var rootObjects = JsonConvert.DeserializeObject<List<RootObject>>(badJson, new JsonSerializerSettings());
var result = rootObjects.Select(item => new ResultRootObject
{
Value = JsonConvert.DeserializeObject<Value>(item.Value),
Nr = item.Nr
}).ToList();