как я могу добавить или вставить запись (в виде массива) в свой json файл, используя php или javascript?
я пробовал этот, но не повезло:
$file = file_get_contents('Copy.json');
$tempArray = json_decode($file);
$arr = array('type' => 'Feature',
'id'=>$adsID,
'properties' => array(
'IMAGE'=>$ALogo,
'NAME'=>$name,
'TEL'=>$ATel,
'URL'=>$url,
'ADRESS1'=>$A_add,
'ADDRESS2'=>'add2',
'CITY'=>'Angeles City',
'ZIP'=>'2009'),
'geometry' => array(
'type' => 'Point',
'coordinates' => array ($ACoords1))
) ;// features
echo json_encode($arr);//$data[] = $_POST['data'];
array_push($tempArray, $arr);
$jsonData = json_encode($tempArray);
file_put_contents('Copy.json', $jsonData);
array merge $ file = file_get_contents ('Copy.json'); $ tempArray = json_decode ($ file);
$arr = array('type' => 'Feature',
'id'=>$adsID,
'properties' => array(
'IMAGE'=>$ALogo,
'NAME'=>$name,
'TEL'=>$ATel,
'URL'=>$url,
'ADRESS1'=>$A_add,
'ADDRESS2'=>'add2',
'CITY'=>'Angeles City',
'ZIP'=>'2009'),
'geometry' => array(
'type' => 'Point',
'coordinates' => array ($ACoords1))
) ;// features
echo json_encode($arr);//$data[] = $_POST['data'];
$merge = array_merge($tempArray, $arr);
$jsonData = json_encode($merge);
file_put_contents('Copy.json', $jsonData);