Skip to content

Instantly share code, notes, and snippets.

@Inzman
Created August 22, 2018 07:13
Show Gist options
  • Select an option

  • Save Inzman/ce52814df063e2b6abbbe53c05f944a7 to your computer and use it in GitHub Desktop.

Select an option

Save Inzman/ce52814df063e2b6abbbe53c05f944a7 to your computer and use it in GitHub Desktop.
To escape backslashes that cause problems for JSON data I use this function.
//escape backslash to avoid errors
var escapeJSON = function(str) {
return str.replace(/\\/g,'\\');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment