Question
· Mar 17, 2023

How to read from a JSON File and convert to HL7 message

Hi Community,

I am trying to read a JSON file and convert into HL7 message.Please find the example below

 

Set Jsonobj={"Doctype":"ADT^A01","PatientId":"123","PatientName":"Alex"}

Set Dynjsonobj= ##class(%Library.DynamicObject).%FromJSON(Jsonobj)

Error :<THROW>%FromJSON+37^%Library.DynamicAbstractObject.1 *%Exception.General READ error while reading input stream 10 Line 1 Offset 0

I am getting this error while reading the file,Can you please tell me where i am doing wrong in converting the file?

Joe

Product version: Ensemble 2018.1
$ZV: Cache for Windows (x86-64) 2018.1.1 (Build 312_1_18937U) Fri Apr 26 2019 17:58:36 EDT
Discussion (9)3
Log in or sign up to continue

Thank you Robert, It worked.

Set Jsonobj="{""Doctype"":""ADT^A01"",""PatientId"":""123"",""PatientName"":""Alex""}"

set dynmicobj={}.%FromJSON(Jsonobj)

Set HL7Obj=##Class(EnsLib.HL7.Message).%New(dynmicobj)

---> here i am trying to open an Object trying to Convert JSON to HL7 message

Can you share any ideas how can i proceed from this steps to convert into HL7 message ?