Skip to content

Instantly share code, notes, and snippets.

@grefel
Last active August 29, 2015 14:05
Show Gist options
  • Save grefel/979d7f612e261f687ff1 to your computer and use it in GitHub Desktop.
Save grefel/979d7f612e261f687ff1 to your computer and use it in GitHub Desktop.
Escaping JSON String from ExtendScript toSource()
var myObject = {text:"a\rz"};
var json = myObject.toSource().replace(/\r/g,"\\r");
var myObject2 = eval(json);
$.writeln(myObject2.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment