Hi I want to put json nested object with this format:
[{"lat":-6.92015,"lon":107.67024,"value":0.1},{"lat":-6.88283,"lon":107.60149,"value":0.1},..]
into this json array :
{"max": 30, "data": [...]}
and will result in this format :
{"max": 30, "data": [{"lat":-6.92015,"lon":107.67024,"value":0.1},...]}
my current code :
$data[] = array(lat=>(float)$row["geo_lat"], lon=>(float)$row["geo_long"], value=>1);
$post_data = json_encode(array('max' => 30, 'data' => $data));
echo $post_data;
How I can do that? Thanks