I'm opening a JSON file and decoding the content of it, so I can insert the content into my database using MySQL:
[{"publisher": "some publisher", "img": "url to image", "title": "some title", "platform": "some platform", "year": "2012", "genre": "some genre", "desc": "this is the description", "id": "1", "developer": "some developer"}]
This is just 1 one of the entries in the file. The JSON file contains more than 10000 of these. I'm getting internal server while using json_decode($file)
. Reading the file and var_dump($file)
works just fine. So my question is, is this a good JSON file? Or how can I decode and insert it in the database?
Thanks in advance.
There is nothing wrong with that fragment of JSON.
You should look at the specific error message reported (either by running the PHP outside a web server, or by looking in the error logs for it). Internal Server Error just means "Something went wrong, an admin/developer should look at the logs".