The #json data tome times thrown an error on console when it get null data instead json data, so here is the best way to check if your data is #json then use it.
[javascript]
function isJSON(json_obj){
try{
JSON.parse(json_obj);
} catch(e){
return false;
}
return true;
}
[/javascript]