forward slash is not escaped in ToString() method


Closed Mar 7, 2012 at 12:53 AM by JamesNK


KubuS wrote Mar 2, 2012 at 3:06 PM

sorry for not providing an example - didn't know ctrl+s is a hot key for posting ;)

var jObj = new JObject(
new JProperty("bad_slash", "slash/not escaped")

"bad_slash": "slash/not escaped"
notice the slash is not escaped.

carlosfigueira wrote Mar 2, 2012 at 6:19 PM

The forward slash doesn't have to be escaped. It can be escaped, just like the 'a' character can be written out as '\u0061'. The only characters which need escaping are the backslash, double quotes and control characters (those under \u0020) - see the RFC at http://www.ietf.org/rfc/rfc4627.txt for the JSON string grammar.

KubuS wrote Mar 2, 2012 at 7:04 PM

@carlosfigueira I've read the RFC and you're right. I guess the issue can be closed then.

wrote Mar 7, 2012 at 12:53 AM

wrote Feb 22, 2013 at 2:48 AM

wrote May 16, 2013 at 1:37 PM