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.

JSON pdecode failes => solved
#1
I get the following data from a HTTP get request:

Code:
* table:
["inverters"]
  * table:
   [1]
    * table:
     ["serial"]
      * string: 000000000000
     ["AC"]
      * table:
       ["0"]
        * table:
         ["Power"]
          * table:
           ["d"]
            * number: 1
           ["v"]
            * number: 627.7999924
           ["u"]
            * string: W

I want to use pdecode to write the values in some group adresses. 


Code:
oDTUResponse = socket.http.request(url)

data3 = json.pdecode(oDTUResponse).inverters[1].serial
log(data3)

data4 = json.pdecode(oDTUResponse).inverters[1].AC["0"].Power.v
log(data4)

Edit: "" were missing in the code.
Reply


Messages In This Thread
JSON pdecode failes => solved - by cgn - 10.06.2024, 21:27

Forum Jump: