Take the 2-minute tour ×  Possible Duplicate: json_encode is
returning NULL?  I'm trying to read JSON data from my text file
'signups.txt' and I'm using the following below. I want to grab
the data from my text file and output the data in a foreach
loop. Here's my code so far, I'm not 100% sure how to go about
it.  $json_data =
json_decode(file_get_contents('includes/signups.txt'), true);
My data:  {"name":"John
Smith","studentid":"10358595","fbid":"1284556651"}  I'm thinking
the following:    • Get file data as a string Encode into JSON
maybe?    • Put the JSON data into an array using 'true'    •
And then decode so that I can use the data  Sorry for been so
vague but I can't seem to find what I'm looking for online. I
apologise if the post is too brief. I'll do my best to add
anything that I might have missed out. Thanks.  Edit: In terms
of my current code, I just get null when I var_dump it.
share|improve this question What is wrong with your current code
? The code works wrong ad returns $json_data as a