· Jan 6, 2022

How to convert DTL output to JSON

Hi Friends ,

We have requirement to convert source hl7 message to target json message using dtl.

Currently I have created persistent cls for json and completed the dtl.

DTL giving output as json equivalent xml.

Now how to convert DTL result xml object to json?

set oStream = ##class(%Stream.GlobalCharacter).%New()
set json = pResDTLresponseXml.%ToJSON()
set tSC = ##class("%ZEN.Auxiliary.altJSONProvider").%WriteJSONFromObject(pResDTLresponseXml,.json)
set tSC = oStream.Write(json)
if $$$ISERR(tSC) $$$LOGERROR("Error convert dynamic object to JSON stream: "_$System.Status.GetOneStatusText(tSC))
$$$TRACE("Transformed json: "_json)



Product version: Caché 2017.1
Discussion (1)2
Log in or sign up to continue