On 2026-11-18, steve g <Sgon…@gmail.com> wrote:
> Anton Antimo <ant…@safunu.org> writes: > >
>> I'm just curious why someone would escape slashes and make it the >> default on a library to handle JSON (of any sort).
> > Microsoft.
I'm obviously not Microsoft: This is the TXR Lisp interactive listener of TXR 302. Quit with :quit or Ctrl-D on an empty line. Ctrl-X ? for cheatsheet. 1> (put-json #("foo" "/bar")) ["foo","/bar"]t 2> (put-json #("foo" "</bar")) ["foo","</bar"]t 3> (put-json #("foo" "</s")) ["foo","</s"]t 4> (put-json #("foo" "</sc")) ["foo","</sc"]t 5> (put-json #("foo" "</scr")) ["foo","</scr"]t 6> (put-json #("foo" "</scri")) ["foo","</scri"]t 7> (put-json #("foo" "</scri>")) ["foo","</scri>"]t 8> (put-json #("foo" "</script>")) ["foo","<\/script>"]t Yes, escaping every slash, regardless of whether it causes a script end tag ambiguity, would annoy users. A slash is a path separator; a shit ton of strings that end up in JSON contain URLs and paths. To have a backslash on each path separating slash would be insane.
-- TXR Programming Language: http://nongnu.org/txr Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal Mastodon: @Kazi…@mstdn.ca