I have problems to create the correct JSON form in PHP.
My JSON so far (i marked # wrong things):
{
"pools": { #this bracket should be [
"1": {
"pool-id": "1",
"pool-name": "pool-nameX",
"real-estates": { #this bracket should be [
"1": {
"object-id": "idX",
"object-name": "nameX",
"object-description": "descX",
"object-type": "typeX",
"wdata": {
"2016": [162.68]
}
}
} #this bracket should be ]
}
} #this bracket should be ]
}
That's my PHP code:
$my_values = array();
$my_values["pools"]["1"] = array('pool-id'=>"1",'pool-name'=>"pool-nameX");
$my_values["pools"]["1"]["real-estates"]["1"] = array('object-id'=>"1",'object-name'=>"nameX",'object-description'=>"descX",'object-type'=>"typeX");
$my_values["pools"]["1"]["real-estates"]["1"]["wdata"]["2016"] = $array_with_values; #example 162,68
I tested some variants with array_push and other one but for some reasons i have problems to get this work.
Hopefully someone could bring me an example of how to create the one i need.
x-thx in advance!