I am receiving a Json response from an API but unable to convert to object.
My class is
public class ResultOrder
{
public int id { get; set; }
public string currency { get; set; }
public string status { get; set; }
public string order_id { get; set; }
public double price { get; set; }
}
var response = await client.PostAsync(path, body);
if (response.IsSuccessStatusCode)
{
var newOrder = await response.Content.ReadAsAsync<dynamic>();
ResultOrder obj = JsonConvert.DeserializeObject(newOrder);
}
And the result i am getting from API in the variable newOrder is --
{
"id": 68456,
"currency": "USD",
"status": "pending",
"price": "79.97",
"order_id": "1233219",
}
But unable to get the deserialized result in the obj variable.