Trying to remove a field and value ("ID") from json file: Can anyone please help with this?
JSON:
[{
"Rating": "1600",
"ID": "16733310",
"Name": "LARRATEGUI,MARTIN",
"Expires": "1000.10.10"
},{
"Rating": "1353",
"ID": "16429901",
"Name": "ADDABBO,ERIC M",
"Expires": "1000.10.10"
}]
TRIED THIS:
<?php
$file = file_get_contents("uscf.json");
$file = str_replace('"ID": "[0-9][0-9][0-9][0-9]",','',$file);
$array = json_decode($file, true);
unset ($array.ID);
echo $array;
?>
Desired result
[{
"Rating": "1600",
"Name": "LARRATEGUI,MARTIN",
"Expires": "1000.10.10"
},{
"Rating": "1353",
"Name": "ADDABBO,ERIC M",
"Expires": "1000.10.10"
}]