I have the following class
public class CallbackResultsJson
{
public class CallbackResults
{
public string Status { get; set; }
public string Message { get; set; }
public string Data { get; set; }
public string Log { get; set; }
public string StatusText { get; set; }
public string TransactionToken { get; set; }
}
}
I am trying to use Json.Net to Deserialize requestbody but I am always getting a null for status,data. any ideas why ?
var requestbody =@"
{
"CallbackResults":
{
"TransactionToken":"b65524-qwe",
"Status":0,
"Message":"Publish Application to QaLevel Operation Completed",
"Data":[],
"Log":["sucess"
},
"RequestNumber":"REQ1234"
}"
var TransactionResult = JsonConvert.DeserializeObject<CallbackResultsJson.CallbackResults>(requestBody);

Statusis an integer, not a string,Datais an array, not a string,Logis a badly formed array (no end bracket). You should get an exception with this JSON, and even if you fix the array forLog, you will get an exception because of the mismatch of types."inside the string but should use""), you're missing a semicolon, and the class names you're using in the deserialization call doesn't match the example class above. You've basically retyped the problem here and made additional errors.