API icon indicating copy to clipboard operation
API copied to clipboard

JSON: newlines and tabs disappear in strings

Open nhthn opened this issue 9 years ago • 3 comments

JSON.stringify("a\n\t")
  -> "a"

nhthn avatar Aug 19 '16 00:08 nhthn

would be nice if we had JSON in the core.

I should check if the JSON implementation in SuperColliderJS (the bridge class) has this problem.

thanks for the report.

crucialfelix avatar Aug 20 '16 12:08 crucialfelix

JSON should def be in core. super popular format in this decade.

nhthn avatar Aug 20 '16 18:08 nhthn

the bug is because of .reject(_.isControl) in https://github.com/crucialfelix/API/blob/master/JSON.sc#L14. \n and \t are control characters

nhthn avatar Aug 22 '16 02:08 nhthn