This is an example of the part of the Json Im trying to deserialize,I also need to be able to send a similar Json by a POST. The thing is that im not sure how im suppose to read all those objects and add them to spesific "adocumentitems" object list, nether to serialize it to that type of object list in JSON format.
{
"adocumentitems":{
"0":{
"sdescription":"PORTÁTILES SIN FLUOROSCOPIA E INTENSIFICADOR DE IMÁGENES PRACTICADO EN HABITACION UCI RN O QUIRÓFANOS",
"sstandarditemidentification":"21601_03 - 21601",
"nunitprice":21854,
"ntotal":21854,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"1":{
"sdescription":"RADIOGRAFIA DE TORAX P.A.O A.P.Y LATERAL DECUBITO LATERAL OBLICUAS O LATERAL CON BARIO",
"sstandarditemidentification":"871121_03 - 871121",
"nunitprice":28924,
"ntotal":28924,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"2":{
"sdescription":"TOMOGRAFIA AXIAL COMPUTADA DE TORAX",
"sstandarditemidentification":"879301_03 - 879301",
"nunitprice":141386,
"ntotal":282772,
"nquantity":2,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"3":{
"sdescription":"CONSULTA DE PRIMERA VEZ POR ESPECIALISTA EN MEDICINA INTERNA",
"sstandarditemidentification":"890266_03 - 890266",
"nunitprice":17514,
"ntotal":17514,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"4":{
"sdescription":"CUIDADO MANEJO INTRAHOSPITALARIO POR MEDICINA ESPECIALIZADA",
"sstandarditemidentification":"890602_03 - 890602",
"nunitprice":21133,
"ntotal":42266,
"nquantity":2,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"5":{
"sdescription":"CONSULTA DE URGENCIAS POR MEDICINA GENERAL",
"sstandarditemidentification":"890701_03 - 890701",
"nunitprice":17395,
"ntotal":17395,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"6":{
"sdescription":"HEMOCULTIVO AEROBIO POR METODO AUTOMATICO",
"sstandarditemidentification":"901221_03 - 901221",
"nunitprice":42560,
"ntotal":85120,
"nquantity":2,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"7":{
"sdescription":"HEMOGRAMA IV [HEMOGLOBINA HEMATOCRITO RECUENTO DE ERITROCITOS-INDICES ERITROCITARIOS-LEUCOGRAMA-RECUENTO DE PLAQUETAS-INDICES PLAQUETARIOS Y MORFOLOGIA ELECTRONICA E HISTOGRAMA] METODO AUTOMATICO",
"sstandarditemidentification":"902210_03 - 902210",
"nunitprice":15421,
"ntotal":15421,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"8":{
"sdescription":"GASES ARTERIALES EN REPOSO O EN EJERCICIO",
"sstandarditemidentification":"903839_03 - 903839",
"nunitprice":17766,
"ntotal":35532,
"nquantity":2,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"9":{
"sdescription":"HABITACION DE CUATRO CAMAS O MAS",
"sstandarditemidentification":"10A004_03 - S11304",
"nunitprice":91966,
"ntotal":183932,
"nquantity":2,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"10":{
"sdescription":"OXIGENO CATETER O CANULA NASAL X HORA",
"sstandarditemidentification":"S55201_03 - S55201",
"nunitprice":2940,
"ntotal":152880,
"nquantity":52,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
},
"11":{
"sdescription":"ACIDO ACETIL SALICILICO 100 mg TABLETA",
"sstandarditemidentification":"19936296-08",
"nunitprice":100,
"ntotal":200,
"nquantity":2,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49 Fecha Egr: 2021-04-11 22:03:00 AUTORIZACION: 146693312"
}
}
The type of JSON list that I know of would look more like this:
{ "adocumentitems": [
{
"sdescription":"PORTÁTILES SIN FLUOROSCOPIA E INTENSIFICADOR DE IMÁGENES PRACTICADO EN HABITACION UCI RN O QUIRÓFANOS",
"sstandarditemidentification":"21601_03 - 21601",
"nunitprice":21854,
"ntotal":21854,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49"
},
{
"sdescription":"PORTÁTILES SIN FLUOROSCOPIA E INTENSIFICADOR DE IMÁGENES PRACTICADO EN HABITACION UCI RN O QUIRÓFANOS",
"sstandarditemidentification":"21601_03 - 21601",
"nunitprice":21854,
"ntotal":21854,
"nquantity":1,
"sgroupname":"TIPO DE INGRESO: URGENCIAS Fecha Ing: 2021-04-09 15:27:49"
} ]
}
But its not this case...
Im working with C#, trying to deserialize it and serialize it with NewtonSoft.
Serializing Object to Json for POST purpose
var JsonData = JsonConvert.SerializeObject(adocumentitems);
Deserializing json response to object when performing a GET
return JsonConvert.DeserializeObject<adocumentitems>(JsonGetResponse);
I'll appreciate if someone could help me understand how to handel this types of json list.