What is the best way to serialize object/list/array/etc to string?
Hello!
Are there any short ways of serializing COS entity to the string? I am searching for something like .$toJSON()
, but I need Caché 2013.* support.
The one way I supposed to work is to use $listbuild
:
set str = $LISTTOSTRING($LB(1,2,3,",",5))
set list = $LISTFROMSTRING(str,",")
zw list
list=$lb("1","2","3","","","5")
But the problem is that $listbuild
does not escape delimiters, and it is not possible to deserialize serialized string. The structure I need to serialize may contain any characters.
Are there any short ways to do this in Caché to avoid writing custom parser?