Hi,
I’m trying to pass in JSON to a InputPort. My code is based on the example code, however no matter what I try I get the error
…
type = “string”;
function set(value) {
server.show(value); // Shows “table” (than a hex no.)
server.log(value.speed);
…
2/20/2013 4:58:06 PM: ERROR: the index ‘speed’ does not exist
2/20/2013 4:58:06 PM: ERROR: at set:43
2/20/2013 4:58:06 PM: ERROR: from constructor:38
2/20/2013 4:58:06 PM: ERROR: from main:81
I’m been posting via cURL:
curl -X POST https://api.electricimp.com/v1/ebbc1fc74209436a/30528d5a87d1c1 -d ‘value={“speed”:100}’
I have an Input node connected to the HTTP in, and it shows:
{speed: 100}
Which suggests that the JSON has been parsed (I’m guessing).
Does any one have any tips on how I access the json values from the table.
Thanks
Gary.