Hello Gabriel, you can use the% ZEN classes, as the example below:
ClassMethod ConvertJSON() As %Status { Set tSC = $$$OK Try{
Set Store = ##class(%ZEN.proxyObject).%New(), Clients = ##class(%ListOfObjects).%New(), Client = ##class(%ZEN.proxyObject).%New() Set Client.code = 1, Client.name = "Leonardo" Do Clients.Insert(Client)
Set Store.name = "Intersystems Store", Store.address = "80 Delancey St, New York, NY", Store.clients = Clients
Check %ZEN.Auxiliary.jsonProvider class, %ObjectToJSON method.
Hello Gabriel, you can use the% ZEN classes, as the example below:
{
Set tSC = $$$OK
Try{
Set Store = ##class(%ZEN.proxyObject).%New(),
Clients = ##class(%ListOfObjects).%New(),
Client = ##class(%ZEN.proxyObject).%New() Set Client.code = 1,
Client.name = "Leonardo"
Do Clients.Insert(Client)
Set Store.name = "Intersystems Store",
Store.address = "80 Delancey St, New York, NY",
Store.clients = Clients
$$$THROWONERROR(tSC, ##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONStreamFromObject(.JsonStore,Store))
Write JsonStore.Read()
} Catch tException {
Set:$$$ISOK(tSC) tSC = tException.AsStatus()
}
Quit tSC
}
That works, thanks!