I have this example of Json structure
[
{
"idgoOperacion": 256,
"Destino": "Actividades Comunitarias",
"Tipo de Solicitante": "-",
"Superficie Otorgada": "",
"Lugar de Firma": "",
"Fecha de Firma": ""
},
{
"idgoOperacion": 263,
"Destino": null,
"Tipo de Solicitante": null,
"Superficie Otorgada": null,
"Lugar de Firma": null,
"Fecha de Firma": null
},
{
"idgoOperacion": 266,
"Destino": "Cultura",
"Tipo de Solicitante": "Civil",
"Superficie Otorgada": "17",
"Lugar de Firma": "",
"Fecha de Firma": "21/06/2015"
},
{
"idgoOperacion": 270,
"Destino": null,
"Tipo de Solicitante": null,
"Superficie Otorgada": valor,
"Lugar de Firma": "",
"Fecha de Firma": null
},
{
"idgoOperacion": 273,
"Destino": null,
"Tipo de Solicitante": null,
"Superficie Otorgada": null,
"Lugar de Firma": null,
"Fecha de Firma": null
},
{
"idgoOperacion": 274,
"Destino": null,
"Tipo de Solicitante": null,
"Superficie Otorgada": valor,
"Lugar de Firma": valor,
"Fecha de Firma": valor
}]
and I have a table with two fields, idgoOperacion, Json.
I need to save the json in the following way for each operation number and so on
idgoOperacion = 256
Json = {"idgoOperacion": 256,"Destino": "Actividades Comunitarias",
"Tipo de Solicitante": "-","Superficie Otorgada": "","Lugar de
Firma": "","Fecha de Firma": ""}
and so on.
try to obtain the value of the Json in the following way but I could not go through the complete json and be able to obtain the value of idgoOperacion.
JArray jsonPreservar = JArray.Parse(jsonText);
dynamic data = JObject.Parse(jsonPreservar[0].ToString());
You must iterate through the entire array, so you can get all the property values.
It is not necessary to use
dynamic
since it returns a typeJObject
and from there you need to getidgoOperacion
from your object in the jsonwhich