Re: Encode string as json string

2016-02-15 Thread Jonathan M Davis via Digitalmars-d
On Monday, 15 February 2016 at 14:09:04 UTC, tcak wrote: Other than generating normal JSON content (stringify), JSON string is used for Javascript string expressions as well. To create a properly encoded Javascript string, the shortest way is JSONValue("this'\\is//the\"text").toString();

Encode string as json string

2016-02-15 Thread tcak via Digitalmars-d
Other than generating normal JSON content (stringify), JSON string is used for Javascript string expressions as well. To create a properly encoded Javascript string, the shortest way is JSONValue("this'\\is//the\"text").toString(); Yes, it works, but it is uncomfortable to write the code as