On 2026-11-16, Anton Antimo <ant…@safunu.org> wrote:
> It seems cl-json is automatically escaping slashes when I invoke
> encode-json-to-string. I located the question
>
> https://stackoverflow.com/questions/60103909
>
> that explains that the JSON spec mandates the escaping of slashes, but
> doesn't really explain why, although it says there's not quite a
> practical need for that.
>
> Do you know why the escaping of slashes was considered in the first place?
It allows JSON to be embedded into HTML.
Consider JSON which looks like this:
[ "</script>" ] // oops: false positive for end of script marker.
[ "<\/script>" ] // no problem
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazi…@mstdn.ca