Skip to content

Instantly share code, notes, and snippets.

@c3ry5
Created August 5, 2015 12:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c3ry5/537b62dc13138c6ff94e to your computer and use it in GitHub Desktop.
Save c3ry5/537b62dc13138c6ff94e to your computer and use it in GitHub Desktop.
A fix for malformed json
JSON.fix = function(obj) {
return obj.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g, '"$2": ');
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment