Escjson
This function adds the back slash () character in a string of character to circumvent the ones that cannot be present in a JSON constant ("
, \
, tab
, or CR
).
DEST_STRING=escjson(SOURCE_STRING)
DEST_STRING
has type Clbfile
or Char
.SOURCE_STRING
has type Clbfile
or Char
.Local Char MYCONSTANT(100),JSONCONSTANT(100)MYCONSTANT='This is an "example" with back\slashes'JSONCONSTANT='"myconstant" : "'+escjson(MYCONSTANT)+'"'# Now JSONCONSTANT contains '"myconstant" : "This is an \\"example\\" with back\\\\slashes"'