{
"general": {
"knx_Gateway": "te",
"knx_Port": "gas",
"knx_Medium": "TP1",
"knx_timezone": "+3"
},
"devices":[
{
"id": "0",
"knx_dn": "testing",
"knx_ga": "2",
"knx_dt": "Bit"
},
{
"id": "1",
"knx_dn": "0",
"knx_ga": "0",
"knx_dt": "Bit"
},
{
"id": "2",
"knx_dn": "0",
"knx_ga": "5",
"knx_dt": "Byte"
},
{
"id": "3",
"knx_dn": "0",
"knx_ga": "0",
"knx_dt": "Byte"
},
{
"id": "4",
"knx_dn": "0",
"knx_ga": "0",
"knx_dt": "Byte"
}
]
}
This is what i tried so far:
//getting the data from the HTML page into an JSON format
$knxGenSet->general->knx_Gateway = $_POST["ipgate"];
$knxGenSet->general->knx_Port = $_POST["ipport"];
$knxGenSet->general->knx_Medium = $_POST["ipmedium"];
$knxGenSet->general->knx_timezone = $_POST["iptimezone"];
for($i=0; $i<5; $i++){
echo "The number is " . $i . "<br>";
$knxGenSet->devices->id = $i;
$knxGenSet->devices->knx_ga = $_POST["dn" + $i];
$knxGenSet->devices->knx_dn = $_POST["ga" + $i];
$knxGenSet->devices->knx_dt = $_POST["dt" + $i];
}
I cant get the other part with devices right it seems that I am doing something wrong here btw i can allready read this json format .. the reading part works perfectly! :)
Thanks in advance (kind of newb on json territory! :()