I'm trying to deserialize JSON into a custom object but all my properties are set to null and not sure what's going on. Does anyone see anything wrong?
JSON Example
{
"Keys": [
{
"RegistrationKey": "asdfasdfa",
"ValidationStatus": "Valid",
"ValidationDescription": null,
"Properties": [
{
"Key": "Guid",
"Value": "i0asd23165323sdfs68661358"
}
]
}
]
}
Here is my Code, where strResponseValid is the JSON above.
Keys myDeserializedObjValid = (Keys)JsonConvert.DeserializeObject(strResponseValid, typeof(Keys));
validationStatusValid = myDeserializedObjValid.ValidationStatus;
Here are my classes
public class Keys
{
public string RegistrationKey { get; set; }
public string ValidationStatus { get; set; }
public string ValidationDescription { get; set; }
public List<Properties> PropertiesList { get; set; }
}
public class Properties
{
public string Key { get; set; }
public string Value { get; set; }
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…