Question PILAR GUERRERO · Jun 29, 2017

%ListOfDataTypes from JSON

Hello...

I need to convert a array  (JSON) in a List Of String. I think, there is some method that does it directly.

Something like that:

SAMPLES>set list = ##class(%ListOfDataTypes).$fromJSON("[""a"",""b"",""c""]")

%FromObject+21^%Library.RegisteredObject.1 *%Exception.General Compose Compose %FromObject Unable to map frm %Library.Array instance to %Library.ListOfDataTypes

I have reading about this but I don't found some trick to help me.

https://community.intersystems.com/post/how-convert-json-listofdatatypes

Thanks!!

Comments

Vitaliy Serdtsev · Jun 29, 2017
#dim list As %ListOfDataTypes
##class(%ZEN.Auxiliary.jsonProvider).%ConvertJSONToObject("[""a"",""b"",""c""]",,.list)
list.Count(),!
0