I want to move this object (in PHP)
(json1.json)
{
"id": "TEST",
"name": "TEST",
"desc": "TEST",
"image": "TEST",
"package": "TEST",
"version": "1.00",
"picpath": "TEST",
"desc_1": "ssss",
"desc_2": "ssss",
"ReviewStars": "5",
"Size": "TEST",
"Author": "TEST",
"apptype": "222",
"pv": "TEST",
"main_icon_path": "TEST",
"main_menu_pic": "TEST",
"releaseddate": "2019-06-19",
}
into this array (json2.json)
{
"packages": [
{
"id": "TEST",
"name": "TEST",
"desc": "TEST",
"image": "TEST",
"package": "TEST",
"version": "1.00",
"picpath": "TEST",
"desc_1": "TEST",
"desc_2": "TEST",
"ReviewStars": "TEST",
"Size": "",
"Author": "TEST",
"apptype": "TEST",
"pv": "TEST",
"main_icon_path": "TEST",
"main_menu_pic": "TEST",
"releaseddate": "5/03/2018"
}
]
}
i want the final json to look like this
{
"packages": [
{
"id": "TEST",
"name": "TEST",
"desc": "TEST",
"image": "TEST",
"package": "TEST",
"version": "1.00",
"picpath": "TEST",
"desc_1": "TEST",
"desc_2": "TEST",
"ReviewStars": "TEST",
"Size": "",
"Author": "TEST",
"apptype": "TEST",
"pv": "TEST",
"main_icon_path": "TEST",
"main_menu_pic": "TEST",
"releaseddate": "5/03/2018"
},
{
"id": "TEST",
"name": "TEST",
"desc": "TEST",
"image": "TEST",
"package": "TEST",
"version": "1.00",
"picpath": "TEST",
"desc_1": "ssss",
"desc_2": "ssss",
"ReviewStars": "5",
"Size": "TEST",
"Author": "TEST",
"apptype": "222",
"pv": "TEST",
"main_icon_path": "TEST",
"main_menu_pic": "TEST",
"releaseddate": "2019-06-19",
}
]
}
iv tried many solutions including this one
$datas[] = json_decode($json, true);
$datas[] = json_decode($json1, true);
$jsonData = json_encode($datas, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
file_put_contents($jpath, $jsonData);```