Question
· Feb 8, 2023

$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
Log in or sign up to continue

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