This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Api Error
#4
(20.05.2020, 18:00)Erwin van der Zwart Wrote: Hi,

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
Hi 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
Reply


Messages In This Thread
Api Error - by arivera - 20.05.2020, 16:40
RE: Api Error - by Daniel - 20.05.2020, 16:47
RE: Api Error - by Erwin van der Zwart - 20.05.2020, 18:00
RE: Api Error - by arivera - 21.05.2020, 17:53
RE: Api Error - by Daniel - 21.05.2020, 18:41
RE: Api Error - by Erwin van der Zwart - 21.05.2020, 19:24
RE: Api Error - by arivera - 21.05.2020, 19:32

Forum Jump: