To use a special character as a regular one, prepend it with a backslash: \.. That’s also called “escaping a … JSON does not mandate forward slashes to be escaped.

Escaping of special characters. Example // Load in depend... Get jQuery version from inspecting the jQuery object. In a case like this I think it is better to stay with the spec. The JSON_UNESCAPED_UNICODE|JSON_UNESCAPED_SLASHES must be default, not an (strange) option… How to say it to php-developers? @jskorpan, The JSON spec says that forward slashes can appear either escaped or not escaped. Unless there is a compelling reason to escape them it would be preferable to follow the behavior of Python's json module and not escape them. Why still forward slashes "must be" escaped. Posted by: admin However it can become a source of confusion when dealing with third-parties. Not “any character”, but just a dot.

javascript – Align Absolutely Positioned Sticky Element to div inside Sibling? The key for this was reading, followed by Not escaping forward slashes does not violate the spec. maybe even as a global setting if that helps to optimize for both cases. We use essential cookies to perform essential website functions, e.g. @jskorpan, hopefully @nickva's answer helps to clarify what the spec says about escaping forward slashes. Hi all, Jettison escapes forward slashes by default. It seems a JSON encoder can choose to escape any character, it must escape certain ones. JSON doesn’t require you to do that, it allows you to do that. Already on GitHub? Also, we looked at what characters were escaped. should we need clarification on the feedback provided or if you need further assistance. @nickva, you are correct, the spec says that a forward slash may appear escaped or unescaped and the meaning is the same. I'd like to propose that forward slashes not be escaped by default but are escaped when encode_html_chars=True is specified. It says: A string is any unicode character except " or \ or 'control character'. This does not mean that it's the right or wrong approach.. but it would seem that in the wild as least there different interpretations of it. The JSON standards do not require this but they also state that it is acceptable. It says: The representation of strings is similar to conventions used in the C © 2014 - All Rights Reserved - Powered by,,, javascript – Angular 2+ Access/Change Variable from Lazy-Loaded component. Note: "control characters" phrase is defined as ASCII characters between 00h and 1fh. You signed in with another tab or window. The JSON spec says that forward slashes may be escaped or not escaped.

The origins of the information on this site may be internal or external to Progress Software Corporation (“Progress”). Allowing \/ helps when embedding JSON in a Top