Documentation
json_decode can return NULL as the documentation states.
Returns the value encoded in json in appropriate PHP type. Values
true, false and null (case-insensitive) are returned as TRUE, FALSE
and NULL respectively. NULL is returned if the json cannot be decoded
or if the encoded data is deeper than the recursion limit.
Your Problem
json_decode is failing here because of \n inside of id 6
{ "id": 6, "url":
"http://jeewanaryal.com/angryQuiz/eighties/images/betterOffDead.jpg",
"question": "In the movie 'Better Off Dead', what was the \n name of
Lane's younger brother?", "answer": [ { "a": { "text": "Bradger",
"status": 1 } }, { "b": { "text": "Peter", "status": 0 } }, { "c": {
"text": "Frank", "status": 0 } }, { "d": { "text": "Michael",
"status": 0 } } ] }
Solution
I guess your best bet here is to escape them before json_decode
$safe_json = str_replace("\n", "\\n", $json);