Question
· Jun 29, 2023

Don't interpret data in ##class(%DynamicAbstractObject).%FromJSON(src)

Hi All,

See code below. We don't want to %FromJSON interpret the data. 

We're creating a method to convert json to csv but we don't want to convert/interpret any of the data

The write in the code snipped below will give 220 as weight instead of 220.00.

Does anyone now a way/method to don't interpret the data without put "" on the values?

Class Tmp.test
{

ClassMethod help()
{
		set src = "{""name"" : ""greg"", ""weight"" : 220.00 }"
     	set obj = ##class(%DynamicAbstractObject).%FromJSON(src)
     	write obj.name,!
     	write obj.weight,!
     	return $$$OK
}

}
Product version: IRIS 2021.2
$ZV: IRIS for Windows (x86-64) 2021.2 (Build 649U) Thu Jan 20 2022 08:46:32 EST [HealthConnect:3.4.0] [HealthConnect:3.4.0]
Discussion (2)1
Log in or sign up to continue