Question
Roger de Coninck · Jun 12, 2018

Alternative for %ZEN.Auxiliary.altJSONProvider).%ConvertJSONToObject

Hello,

I want to convert a json, which passed on in the a REST call, into a request message. 

I use method %ConvertJSONToObject of the %ZEN.Auxiliary.altJSONProvider class.

Set sc = ##class(%ZEN.Auxiliary.altJSONProvider).%ConvertJSONToObject(%request.Content, "TestRequest", .request)

Is there an alternative for this? I want to avoid to use the %ZEN library.

Best Regards

Roger de Coninck

00
3 0 8 491
Log in or sign up to continue

I want to de-serialize an json string, received via REST, into a Ens.Request.

Best Regards

Roger.

I known how to create a dynamic object from a json string.

What do you mean with "create Ens.Request from that" ?

First create the request and assign the property one by one?

Or do you mean something else?

Best Regards

Roger.

First create the request and assign the property one by one?

Yes.

You need first to convert JSON into dynamic object and then create Ens.Request from that. Well, probably a subclass of Ens.Request as it can't hold any data.