21.05.2020, 17:53
(20.05.2020, 18:00)Erwin van der Zwart Wrote: Hi,Hi Erwin
Are you trying to read this JSON direct (not possible to do, so your error might come from there) or do you have json.pdecode somewhere to convert it to a LUA table?
What i see in first sight is your table has other fields, first of all Data is with a capital D so the fields should be tablename.Data.PAC.Values but i also see a main wrapping table called Body so shouldn’t your code be tablename.Body.Data.PAC.Values ?
BR,
Erwin
I have a json.decode somewhere to convert it to a LUA table
effectively the problem was capital D but when I try to read the Value of field 1 with the following command
Line 21 day = data.Body.Data.DAY_ENERGY.Values.1
"Body":{
"Data":{
"DAY_ENERGY":{
"Unit":"Wh",
"Values":{
"1":56350,
"2":85580
it gives me a syntax error
Error de sintaxis en la linea 21: ')' expected near '.1'
If I execute the sentence as follows
Line 21 day = data.Body.Data.DAY_ENERGY.Values
I open the registration window I see the 2 values perfectly
How can I read the value 1 and 2 from the table?
I do not know how to send a screenshot to send the script because when I give the insert image icon it asks me for a URL or how to send a screenshot
Thank you