Proper way to catch exception from JSON.parse
i post something into an iframe then read back the contents of the iframe with json parse…so sometimes it’s not a json string Try this: if(response) { try { a = JSON.parse(response); } catch(e) { alert(e); // error in the above string (in this case, yes)! } }