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
above. Two issues:
1. It creates a struct, and there are extra processing in the
background (check the source code for this.)
2. It is really long.
std.json already has a string encoding function in it, but it is
not exposed outside.
https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L1002
It would be quite useful to expose this function for ease of use.
Any thoughts?