0
After almost 3 days trying to implement I did not succeed. I have the following json:
{ "code": 200,
"data": [
{ "id": 1, "type": "charge", "custom_id": "1208", "status": { "current": "new", "previous": null }, "identifiers": { "charge_id": 542814 }, "created_at": "2018-12-03 11:15:24" },
{ "id": 2, "type": "charge", "custom_id": "1208", "status": { "current": "waiting", "previous": "new" }, "identifiers": { "charge_id": 542814 }, "created_at": "2018-12-03 11:15:28" } ] }
My goal is to get the item "status". The following code works well:
dynamic stuff1 = Newtonsoft.Json.JsonConvert.DeserializeObject(jo);
string Text = stuff1.data.status.current;
The code works to get the first line item, but how do I get the attribute "status" always on the last line, because it will always grow. I tried to use the .ToLast()
to get the last record of "Current" but I’m not succeeding.
Antonio, thanks for the answer, he gave the following error: The best match of overloaded method 'Newtonsoft.Json.Jsonconvert.Deserializeobject<Siglaadministratión.Web.Query.Rootobject>(string)' has some invalid arguments
– Claudinei Ferreira
But I understood the logic you provided, I’ll implement here and I’ll tell you how it was.
– Claudinei Ferreira
The variable "string" is of type string and has there json?
– António