$zcvt("abc/def","O","JSON")="abc/def" -> Why?
Checked on Cache 2018.1.7 and IRIS 2022.2
write$zconvert("abc/def","O","JSON")
"abc/def" Why isn't it "abc\/def" ?
Discussion (2)3
Comments
See table at this link https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls?KEY=RCOS_fzconvert#RCOS_fzconvert_jsml
You likely need "JS" transformation:
USER>write $zconvert("abc/def","O","JS")
abc\/def
The quoting of the slash character, "/", is optional in JSON. When doing a $ZCVT output conversion ,"O", in JSON IRIS chooses to not quote the slash character. It makes the output easier to read. However, $ZCVT doing an input conversion, "I", will recognize a quoted slash character in JSON input. E.g.:
USER>w $zcvt("abc\/def","I","JSON")
abc/def
USER>w $zcvt("abc/def","I","JSON")
abc/def