Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Everybody,
I need to parse a JSON from TrestClient and save the data into a table.
This is an example of my JSON:
{"eventi_carichi":[{
"codice_base":"6111",
"id_evento":0,
"data_viaggio":"2020-01-24T00:00:00",
"numero_viaggio":293137,
"nome_autista":"MARIO",
"motrice":"AAA123",
"rimorchio":"BBB456",
"ora_inizio":"07:33:05",
"ora_fine":"07:44:38",
"durata":693,
"codice_prodotto":"SSP",
"litri_programmati":9000,
"litri_erogati":9001,
"litri15_erogati":9087,
"densita_ambiente":0.0,
"densita15":0.7247
},
{"codice_base":"6111",
"id_evento":0,
"data_viaggio":"2020-01-24T00:00:00",
"numero_viaggio":293137,
"nome_autista":"CARLO",
"motrice":"CCC987",
"rimorchio":"DDD856",
"ora_inizio":"07:33:05",
"ora_fine":"07:51:26",
"durata":1101,
"codice_prodotto":"GAS",
"litri_programmati":27000,
"litri_erogati":27003,
"litri15_erogati":27011,
"densita_ambiente":0.0,
"densita15":0.841}
]
}
this is how i'm trying to do it:
But I am getting the following error:
JSONObject text must begin with '{' at character 1 of "{\"eventi_carichi\":[{\"codice_base\":.....
Any ideas?? I'm going crazy!
You appear to be using XPath for this. It might be easier to use JsonPath and set your loop to.....
"$.eventi_carichi[*]"
If you are regularly working with JSON it makes sense not to rely on XPath. There are certain pieces of functionality that do not translate between JSONPath and XPath.