I am new in this json issues and parsing, the point is that I have a PHP file, 2 bottons to control the state of 2 leds. I manege to achive this in PHP
$luces = array(
'lighta' => $lighta,
'lightb' => $lightb,
);
$jsonluces = json_encode($luces);
file_put_contents('lights.json', $jsonluces);
so these are the 4 posibble answers I can get in the lights.json file
{"lighta":"on","lightb":null} or
{"lighta":"off","lightb":null} or
{"lighta":null,"lightb":"on"} or
{"lighta":null,"lightb":"off"}
but now I am done to see how I get those values on a LUA table, any help?
I am very new in this (mainly PHP and parsing), 1srt I tried was to change the PHP, so if its null, I fixed whether
$lighta or $lightb a text ("whatever"), but the page goes down.
Any answer will be great, thanks in advance.
Luciano