· May 25, 2017

How can i convert my object in JSON ?


I’m creating a REST API service but I need to convert my object in JSON.

The Class “A” is extended from another Class “B”:

Class message_B Extends Ens.Request

Property ClientId As %String(MAXLEN = "");

Property mesagge As %String(MAXLEN = "");

Class message_A Extends message_B
Property idDate As %String;

Property Datetime As %String;

Property time As %String;


When I use:

set pRequest = ##Class(message_A).%New()
​do ##class(Ens.Util.JSON).ObjectToJSONStream(pRequest, .content)

This convert all properties  (A y B), but I want that only convert properties in A. I mean, in JSON appear all property, incluided ClientId, mesagge, however I want that this varibales not appear in my JSON.

How can i do ?

Discussion (7)0
Log in or sign up to continue