(03.09.2020, 06:29)admin Wrote: You need to combine table items to a single string and the decode it from JSON to Lua table. This example will log the short name and the first value of values entry.Hello
Code:response = table.concat(response_body)
data = require('json').pdecode(response)
log(data.indicator.short_name)
log(data.indicator.values[ 1 ].value)
It works perfectly, thanks.
The meaning of this part is that you get a table with a single field, we transform it into a string (json) and decode it into a table. I thought that from Esios the json was obtained directly as it happens in other APIs and that is why I did not understand how to use the result.
By the way, why is it due to use this form data = require ('json'). pdecode (response) instead of json.decode (response) and why in safe mode?
Thank you very much for your time.