Code: [Local Link Removed for Guests]
for lcnt = 1 to 3
IntTemp(lcnt) = val(json$(NewData$,"feeds[" + str$(lcnt) + "].field4"))
wlog "Query string : feeds[" + str$(lcnt) + "].field4" + " Response " + str$(IntTemp(lcnt) )
next lcnt
Query string : feeds[1].field4 Response 12.6
Query string : feeds[2].field4 Response 0
Query string : feeds[3].field4 Response 0
UPDATE - SORTED!!!
It works if I move the array reference to the end :
json$(NewData$,"feeds.field4[1]")
json$(NewData$,"feeds.field4[2]")
json$(NewData$,"feeds.field4[3]")
Which may be at odds with correct JSON structure and the example in the help file?
This is the JSON data received from ThingSpeak after running through a formatter.
Code: [Local Link Removed for Guests]
{
"channel":{
"id":1283507,
"name":"Greenhouse Monitor",
"description":"Monitoring internal and external greenhouse environment with ESP32 and 2 x BME280.\r\nESP32 is running Annex RDS. ",
"latitude":"0.0",
"longitude":"0.0",
"field1":"Battery",
"field2":"Wifi RSSI",
"field3":"Atm. Pressure",
"field4":"Internal Temp.",
"field5":"Internal Hum.",
"field6":"External Temp.",
"field7":"External Hum.",
"created_at":"2021-01-15T22:52:34Z",
"updated_at":"2021-03-14T18:18:06Z",
"last_entry_id":7654
},
"feeds":[
{
"created_at":"2021-04-09T15:29:20Z",
"entry_id":7652,
"field1":"3.7",
"field2":"45",
"field3":"1014",
"field4":"12.6",
"field5":"82",
"field6":"8.4",
"field7":"84"
},
{
"created_at":"2021-04-09T15:39:18Z",
"entry_id":7653,
"field1":"3.7",
"field2":"45",
"field3":"1014",
"field4":"12.6",
"field5":"82",
"field6":"8.5",
"field7":"84"
},
{
"created_at":"2021-04-09T15:49:17Z",
"entry_id":7654,
"field1":"3.7",
"field2":"45",
"field3":"1014",
"field4":"12.5",
"field5":"82",
"field6":"8.4",
"field7":"83"
}
]
}