Question
· May 22, 2022

Convert JSON to objectstream

Hi Guys,

I'm running Ensemble 2014 and I'm using this to convert JSON to object:

class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject

 but how can I convert to %CharacterStream because I'm saving a %CharacterStream field

 

Thanks

Product version: Ensemble 2014.1
Discussion (1)1
Log in or sign up to continue

Do you expect to save #1) the input JSON object or
#2) a dump of the converted result?
For both:

set stream=##class( %Stream.GlobalCharacter).%New()

#1)  with myjson as your JSON input

do stream.Write(myjson)
do stream.%Save()  

#2) dump the generated Object  obj  using my package Full-OBJ-Dump described here

do ##class(Z.obj).dumpToStream(.stream,obj,1)
do stream.%Save()