Skip to content

Instantly share code, notes, and snippets.

@jswhisperer
Created May 26, 2013 10:16
Show Gist options
  • Save jswhisperer/5652338 to your computer and use it in GitHub Desktop.
Save jswhisperer/5652338 to your computer and use it in GitHub Desktop.
Better way to convert string to JSON
try{
return JSON.parse(my_string);
}catch(err){
return JSON.parse('"'+my_string+'"');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment