Skip to content

Instantly share code, notes, and snippets.

@meub meub/gist:6091400
Created Jul 26, 2013

What would you like to do?
Prevent parseJSON from barfing on line breaks.
function parse(text) {
text = str_replace("\r\n", "\n", text);
text = str_replace("\r", "\n", text);
text = str_replace("\n", "\\n", text);
return text;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.