Hi all
I have a PHP import script I built about a year ago, been working great! Though all of a sudden, my json_decode
has started returning a NULL value resulting in:
Warning: Invalid argument supplied for foreach() in…
PHP Version 5.3.29
$json = json_decode(file_get_contents('events.json'), true);
foreach ($json as $row) {
...
var_dump($json); // Equals NULL
Events.json - Example
[
{
"TRANSP": "OPAQUE",
"DTEND": "20160601T020000Z",
"DTSTAMP": "20160524T185925Z",
"LOCATION": "Big Warehouse",
"DESCRIPTION": "",
"SEQUENCE": "26533666",
"SUMMARY": "Tickets OUT NOW!",
"DTSTART": "20160531T210000Z",
"CREATED": "20150722T163139Z"
},
{
"TRANSP": "OPAQUE",
"DTEND": "20160601T020000Z",
"DTSTAMP": "20160524T185925Z",
"LOCATION": "Small Warehouse",
"DESCRIPTION": "",
"SEQUENCE": "26533666",
"SUMMARY": "Tickets SOLD OUT!",
"DTSTART": "20160531T210000Z",
"CREATED": "20150722T163139Z"
}
]
Tired everything - Just can’t figure out why this has suddenly stopped working?
The only thing I can think of, might be caused by the DESCRIPTION
which has random data/characters that are not converting.
Any ideas?
Thanks, Barry