Skip to main content

%ZEN.Auxiliary.jsonProvider

Class %ZEN.Auxiliary.jsonProvider Extends %ZEN.Auxiliary.abstractController [ Deprecated, System = 3 ]

The jsonProvider component provides a way to transport object data between a server and client (and vice versa) using JavaScript Object Notation (commonly abbreviated as JSON), as defined in RFC4627.
JSON format refers to a common JavaScript programming technique where you define a set of one or more objects using object literal syntax:
var obj = { "name": "Bill" }; The jsonProvider works as follows:

  • You place an instance of the (invisible) jsonProvider component on your page.
  • You supply a callback method, OnGetTargetObject, that creates an object or set of objects and returns it. This can be an instance of a specific class or classes or it can use the generic %ZEN.proxyObject.
  • The jsonProvider converts the target object to a set of JavaScript objects when the page is rendered (which you can see if you view the source of the page as sent to the client).
  • The jsonProvider has a client-side method, getContentObject(), which returns the client-side version of the target object. This is simply a graph of generic JavaScript Object objects. These objects will have the same properties and values as the target objects. If the target objects refer to other objects or have collections (literal or object-valued) then the JavaScript object will have corresponding object or collection properties.
  • The client can modify these client-side objects or replace them completely using the setContentObject() method.
  • The client can ship its content objects back to the server for processing by calling the submitContent() method. This converts the objects back into server-side objects and invokes the callback method specified by the OnSubmitContent property.
  • The callback defined by OnSubmitContent can modify the objects shipped to it or return a completely different set of objects. This makes it possible to use the jsonProvider as a way to execute different types of server operations. Using the jsonProvider component as an object transport has advantages and disadvantages when compared with other mechanisms provided by Zen, such as the built-in transport provided for Zen components. The main advantage is that you can transport data without having to create or modify server classes — you can ship most any server-side object using this technique. The disadvantages are:
  • You can ship a set of objects, but the objects must form a graph from a "parent" object down through levels of "children" (this is due to how JSON format data is reconstituted on the client). You cannot have child objects refer to parents, siblings or other objects outside of the graph.
  • This approach uses late binding so it is not as efficient as the code generated approach used by Zen components.
  • Not all object properties are supported: you cannot ship binary streams or values. Only references to "child" objects are transported. Any user-defined Javascript properties whose name starts with "_" (an underscore) are not included in the content shipped back to the server. The jsonProvider code may also be invoked from a non-Zen context by calling one of the following APIs:
  • %WriteJSONFromArray
  • %WriteJSONFromObject
  • %WriteJSONStreamFromArray
  • %WriteJSONStreamFromObject
  • %ConvertJSONToObject

Parameters

SYSMODULE

Parameter SYSMODULE = "json";

DEFAULTVISIBLE

Parameter DEFAULTVISIBLE = 0;

This component is not visible.

Properties

targetClass

Property targetClass As %ZEN.Datatype.className;

Class name of the target object expected to be served by this component. Setting the target object will also set this as a side effect.

%TargetObject

Property %TargetObject As %RegisteredObject(XMLPROJECTION = "none") [ Internal, Private ];

Used to hold the target object.

%ObjectReplacement

Property %ObjectReplacement As %RegisteredObject(XMLPROJECTION = "none") [ Internal, Private ];

Used to temporarily hold the response object returned by the OnSubmitContent() callback.

content

Property content As %ZEN.Datatype.string(XMLPROJECTION = "none", ZENSETTING = 0) [ Internal ];

This property contains the JSON-notation content of the target object.
This is automatically set in any of the following ways:

  • When the server-side OnGetTargetObject callback is called.
  • When the server-side %SetTargetObject() method is called.
  • When the client-side setContentObject() method is called.
  • When the client-side setContentText() method is called. Use the getContentObject() method to get the contents of this property.

error

Property error As %ZEN.Datatype.string(XMLPROJECTION = "none", ZENSETTING = 0);

Run-time value. Set to indicate an error within this component.
This is primarily used by controls. It is defined here for flexibility.

parameters

Property parameters As array Of %ZEN.Auxiliary.parameter(XMLKEYNAME = "paramName", XMLNAME = "parameter", XMLPROJECTION = "ELEMENT");

User-defined set of parameters. These values are passed on to the user callback function that provides the contents of this view. Typically this is used to hold search parameters.

%Format

Property %Format As %ZEN.Datatype.string [ InitialExpression = "aceloqtw" ];

Flags string consisting of character options that control output formatting.
JSON written out using the OnRenderJSON callback is not affected by this value. See the description of method %ObjectToJSON() for a list of options this value may include.

OnGetTargetObject

Property OnGetTargetObject As %ZEN.Datatype.delegator(FORMALSPEC = "&pParameters:%String,*pObject:%RegisteredObject", RETURNTYPE = "%Status");

Supply data for the JSON provider as a set of server objects.
This callback method is invoked when the page containing this jsonProvider is rendered. It is expected to return (by reference) an instance of the object whose data is to be provided to the client in JSON format.
For example:
Method GetTarget( ByRef pParameters As %String, Output pObject As %RegisteredObject) As %Status { Set pObject = ##class(MyApp.MyClass).%New() Set pObject.Name = "Bob" Quit $$$OK }

OnGetArray

Property OnGetArray As %ZEN.Datatype.delegator(FORMALSPEC = "&pParameters:%String,*pMetaData,*pData", RETURNTYPE = "%Status");

Supply data for the JSON provider as a server-side array.
This callback method is invoked when the page containing this jsonProvider is rendered.
This callback provides an easy way to ship a set of identical objects to the client by filling in a multidimensional array. The callback method is expected to fill in two structures:
pMetaData is a $List containing the names of the properties of the objects in the order in which they will appear.
pData is an array containing the data. Each node in the array should be a $List containing values for properties. This should match the meta data provided in pMetaData. The array of data can use any subscript value its wants. It is possible to define a hierarchical array. In this case, children nodes are placed within a parent collection called children.
If this callback is defined, then the OnGetTargetObject callback will not be invoked. For example:
Method GetArray( ByRef pParameters As %String, Output pMetaData, Output pData) As %Status { Set pMetaData = $LB("name","rank","serialNo") Set pData(1) = $LB("Smith","Captain","444-33-2222") Set pData(1,1) = $LB("Jones","Corporal","333-22-3333") Quit $$$OK } This would result in the two objects being shipped to the client (in JSON format): var content = { "name": "Smith", "rank": "Captain", "serialNo": "444-33-2222", "children": [ { "name": "Jones", "rank": "Corporal", "serialNo": "333-22-3333" } ] };

OnSubmitContent

Property OnSubmitContent As %ZEN.Datatype.delegator(FORMALSPEC = "pCommand:%String,pProvider:%ZEN.Auxiliary.jsonProvider,pSubmitObject:%RegisteredObject,&pResponseObject:%RegisteredObject", RETURNTYPE = "%Status");

This callback method is invoked when the client submits an object to the server by calling the submitContent() method. The callback is passed the submitted object in pSubmitObject after it has been converted from JSON format back into an object instance. It is also passed the command string supplied to the submitContent() method in pCommand.
If the callback method returns an object via the pResponseObject argument, then this object is returned to the client and becomes the new content of the JSON provider.
For example:
Method SubmitHandler( pCommand As %String, pProvider As %ZEN.Auxiliary.jsonProvider, pSubmitObject As %RegisteredObject, Output pResponseObject As %RegisteredObject) As %Status { Set tSC = $$$OK If ($IsObject(pObject)) { Set tSC = pObject.%Save() } Quit tSC }

OnRenderJSON

Property OnRenderJSON As %ZEN.Datatype.delegator(FORMALSPEC = "&pParameters:%String", RETURNTYPE = "%Status");

Optional. If implemented this callback is expected to write out to the current device the contents of a set of related objects in JSON format.
If present, this overrides the default behavior of this component and the OnGetTargetObject callback is ignored.

seriesNameProperty

Property seriesNameProperty As %ZEN.Datatype.string [ InitialExpression = "caption" ];

Optional. When this provider is used as a data controller, this is the name of the property in the JSON data that provides the series names to view connected to the provider. The default is "caption".

contentType

Property contentType As %ZEN.Datatype.string [ Internal ];

Indicates what kind of data is supplied by this provider. This can be: "object" (an object or graph of objects) or "array" (an array of objects).
This is set automatically. For custom JSON output, the user specified value is used.

propertyList

Property propertyList As %ZEN.Datatype.csv;

Optional. If supplied this is an comma-delimited list of property names. These names are used to define the default ordering of properties supplied by this provider. If a property name is in the list but not in the content data, it is used but will have a value of ''. Properties in the content object but not in this list are listed at the end.

%containerClass

Property %containerClass As %ZEN.Datatype.string [ Internal ];

Name of class containing callback methods when this provider is used in direct (non-Zen) mode. See %WriteJSONFromArray for details.

documentId

Property documentId As %ZEN.Datatype.string;

Optional. If provided (and no other callbacks are defined), then this is the id of a document interface (subclass of %ZEN.DataModel.AbstractDocument) that is used to supply data to the provider.
A document id takes the form "docName/docInstance", where *docName* is the logical name of a data document and *docInstance* is a instance id.

Methods

%DrawJSON

Method %DrawJSON() As %Status [ Internal ]

Draw JSON output for the target object.

%SetTargetObject

Method %SetTargetObject(pObject As %RegisteredObject) As %Status

Set pObject as the target object for this provider.
Set targetClass to the target object class.

%OnGetArray

Method %OnGetArray(ByRef pParms, Output pMetaData, Output pData) As %Status [ Internal ]

Invoke the OnGetArray callback.

%OnGetTargetObject

Method %OnGetTargetObject(ByRef pParms, Output pObject As %RegisteredObject) As %Status [ Internal ]

Invoke the OnGetTargetObject callback.

%OnSubmitContent

Method %OnSubmitContent(pCommand As %String, pSubmitObject As %RegisteredObject, ByRef pResponseObject As %RegisteredObject) As %Status [ Internal ]

Invoke the OnSubmitContent callback.
If pResponseObject is returned, then it is passed back to the client.

%OnRenderJSON

Method %OnRenderJSON(ByRef pParms) As %Status [ Internal ]

Invoke the OnRenderJSON callback.

getContentObject

ClientMethod getContentObject() [ Language = javascript ]

Return the client-side JSON data as an object or null.

getContentType

ClientMethod getContentType() [ Language = javascript ]

Return the type of the data supplied by this provider: "object" or "array".

setContentType

ClientMethod setContentType(type) [ Language = javascript ]

Set the type of the data supplied by this provider: "object" or "array".

setContentObject

ClientMethod setContentObject(obj) [ Language = javascript ]

Make obj the new target object for this provider.

setContentText

ClientMethod setContentText(json) [ Language = javascript ]

Set the content for this provider using the string json. json is expected to contain object data in JSON format.

submitContent

ClientMethod submitContent(command, targetClass, notify, time) [ Language = javascript ]

Send the current target object for this provider to the server for processing. This will recreate the object on the server and invoke the OnSubmitContent callback.
This method will return true if successful and false otherwise. If the method fails, an error string is placed in this object's error property (accessible via the getError() method).
command is an optional string that is passed on to the server callback method to allow for different behaviors in the server logic.
targetClass is an optional argument that, if specified, should be the name of the server-class that you wish to have instantiated on the server. This has the same effect as setting the targetClass property. This makes it possible to submit content for different object classes. If the server cannot create an instance of the specified class, it will return an error.
Normally the submit operation is synchronous. If the optional notify parameter is a function, then the operation will be invoked asynchronously and notify will be invoked when the operation is complete. Note that only one asynchronous operation can be handled at a time.
If time is defined, then raise the notify function every time milliseconds until the task is complete.

reloadContents

ClientMethod reloadContents() [ Language = javascript ]

Reload the contents of the provider with data from the server.
Unlike the submitContent() method, this does not send data to the server.
This is typically used in conjunction with the OnGetArray callback — this method will call the server and the server, in turn, will invoke the OnGetArray callback to create new content to ship back to the client.

reloadContentsAsynch

ClientMethod reloadContentsAsynch(notify, time) [ Language = javascript ]

Reload the contents of the json provider asynchronously; invoke the function notify when complete. If time is defined, then raise the notify function every time ms until the task is complete.

refreshHandler

ClientMethod refreshHandler(final, notify) [ Internal, Language = javascript ]

Called when async refresh is complete (final is true) or when the notifier timer fires.

submitHandler

ClientMethod submitHandler(final, notify) [ Internal, Language = javascript ]

Called when async submit is complete (final is true) or when the notifier timer fires.

refreshContent

ClientMethod refreshContent() [ Language = javascript ]

Deprecated: use reloadContents().

getError

ClientMethod getError() [ Language = javascript ]

Get the current value of the error property. This is set when a server-side method encounters an error.

SubmitToServer

Method SubmitToServer(pCommand As %String, pContent As %String, pTargetClass As %String) As %Boolean [ Internal, ZenMethod ]

This server-side method is called by the submitContent() method.

SubmitToServerAsync

Method SubmitToServerAsync(pCommand As %String, pContent As %String, pTargetClass As %String) [ Internal, ZenMethod ]

This server-side method is called by the submitContent() method in async mode.

RefreshFromServer

Method RefreshFromServer() As %Boolean [ Internal, ZenMethod ]

This server-side method is called by the reloadContents() method.

RefreshFromServerAsynch

Method RefreshFromServerAsynch() [ Internal, ZenMethod ]

This server-side method is called by the reloadContentsAsynch() method.

hasObjContent

ClassMethod hasObjContent(pObject As %RegisteredObject, ByRef pVisited, pFormat As %String, pRecursing As %Boolean = 0) As %Boolean [ Internal ]

Drill down just enough to find out if the object has any content displayable as JSON given the current pFormat options.

%ObjectToJSON

ClassMethod %ObjectToJSON(pObject As %RegisteredObject, ByRef pVisited, pLevel As %Integer = 0, pFormat As %String = "aceloqtw") As %Status

Write out the contents of object instance pObject to the current device using JSON notation. pFormat is a flags string to control output formatting options. The following character option codes are supported:
1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
a - output null arrays/objects
b - line break before opening { of objects
c - output the ObjectScript-specific "_class" and "_id" properties
d - output numeric properties that have value "" as null
e - output empty object properties
i - indent with 4 spaces unless 't' or 1-9
l - output empty lists
n - newline (lf)
o - output empty arrays/objects
q - output numeric values unquoted even when they come from a non-numeric property
s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
t - indent with tab character
u - output pre-converted to UTF-8 instead of in native internal format
w - Windows-style cr/lf newline

%ArrayToJSON

ClassMethod %ArrayToJSON(ByRef pMetaData, ByRef pData, pFormat As %String = "tw") As %Status [ PublicList = pData ]

Write out the contents of the local array pData to the current device using JSON notation pMetaData is a $List containing the names of the properties of the objects in the order in which they will appear.
pData is an array containing the data. Each node in the array should be a $List containing values for properties. This should match the meta data provided in pMetaData. The array of data can use any subscript value its wants. It is possible to define a hierarchical array. In this case, children nodes are placed within a parent collection called children.
pFormat is a flags string that controls output formatting options.
The following character option codes are supported:
1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
b - line break before opening { of objects
i - indent with 4 spaces unless 't' or 1-9
n - newline (lf)
s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
t - indent with tab character
u - output pre-converted to UTF-8 instead of in native internal format
w - Windows-style cr/lf newline

toJSON

ClientMethod toJSON(obj, cycle, level) [ Internal, Language = javascript ]

Convert object obj to JavaScript object literal syntax (JSON) so that it can be shipped to the server.
Note that you cannot convert objects that refer to native types to JSON, this includes any HTML elements or Zen components.

%ParseJSON

ClassMethod %ParseJSON(pJSON As %String, pClass As %String = "", Output pObject As %RegisteredObject, Output pCharsProcessed As %Integer, pLevel As %Integer = 1, pStreamBuffer As %String = "", pIgnoreUnknownProps As %Boolean = 0, pPos As %Integer = 1) As %Status [ Internal ]

Parse the string pJSON containing JSON notation and convert it to an object instance pObject.
pJSON could also be a character stream.
pClass is the name of the class to create to hold the instantiated object. This class must match the data within the JSON notation. If pClass is empty (""), then an instance of the generic class %ZEN.proxyObject will be created. pCharsProcessed and pLevel are used internally and do not have to be supplied. pIgnoreUnknownProps controls whether we will ignore errors when we process a property that isn't expected. The default behaviour is to treat this as an error.
Note that this method assumes well-formed JSON notation: it does not perform complete error checking.

%WriteJSONToFile

ClassMethod %WriteJSONToFile(pJSON As %String, pFileName As %String) As %Status [ Internal ]

Diagnostic method: write JSON content to the given file.

%ParseFile

ClassMethod %ParseFile(pFileName As %String, pClass As %String = "", Output pObject As %RegisteredObject) As %Status [ Internal ]

Test method: process JSON content from the given file.

setProperty

ClientMethod setProperty(property, value, value2) [ Internal, Language = javascript ]

Set the value of a named property.
This is part of the data controller API.

%ClearContentModified

Method %ClearContentModified() [ Internal ]

Clear the (shadow) modified bit for the content property.

%SetContentModified

Method %SetContentModified() [ Internal ]

Set the (shadow) modified bit for the content property.

%OnDrawObjectProperties

Method %OnDrawObjectProperties() [ Internal ]

Render the JSON content of the target object along with the other properties of the provider.

%OnObjectSynch

Method %OnObjectSynch() As %Status [ Internal ]

Render the JSON content of the target object along with the other properties of the provider.

getDimensions

ClientMethod getDimensions() [ Internal, Language = javascript ]

Return number of dimensions in the data. Fixed at 2 for JSON.

resetMetaData

ClientMethod resetMetaData() [ Final, Internal, Language = javascript ]

Reset the metadata for this provider. When used as a data controller this will force recalculation of the meta data (property names) when this data is next used for rendering.

findMetaData

ClientMethod findMetaData() [ Final, Internal, Language = javascript ]

Determine the property names for the current data.
If the content type is "array", then assume that the model is an array of children and all children are the same. If the content type is "object", use the properties of the object.

getObjectMetaData

ClientMethod getObjectMetaData(data, metaData, props, parent) [ Internal, Language = javascript ]

Add the properties in object data to the metaData list. Ignore any properties in props.

getDimSize

ClientMethod getDimSize(dim) [ Language = javascript ]

Return the number of items in the specified dimension (dim is 1,2, or 3).

getDataAsArrays

ClientMethod getDataAsArrays() [ Final, Language = javascript ]

This is a specialized variant of getData() that returns the data in this controller as an array of arrays (used by charts).

getLabel

ClientMethod getLabel(n, dim) [ Language = javascript ]

Get the label at position n (0-based) in the given dimension (1,2, or 3).

getDataSourceCaption

ClientMethod getDataSourceCaption(which, text) [ Language = javascript ]

Return a title to display for this data source. This provides the title for a chart.
which indicates which type of caption: "title", "subtitle",etc. text is the original text for the caption.

getDataByName

ClientMethod getDataByName(property, series) [ Internal, Language = javascript ]

Data API. Lookup a value by its name.

getData

ClientMethod getData(d1, d2, d3) [ Language = javascript ]

dataSet API
Return the data contained in the specified location. Location is 0-based.

setData

ClientMethod setData(value, d1, d2, d3) [ Internal, Language = javascript ]

Set the data contained in the specified location. Location is 0-based.
This is part of the dataController API.

getPropertyName

ClientMethod getPropertyName(n) [ Language = javascript ]

Given a 0-based index, return the corresponding property name.

setDataByName

ClientMethod setDataByName(property, value, series) [ Internal, Language = javascript ]

This is part of the data controller API. Set a data value, by property name, into this dataController.
If property is "%id", then change the id of this controller.
If property is "%series", then change the defaultSeries of this controller.

%AcquireData

Method %AcquireData() As %Status [ Internal ]

Acquire data from the associated DataModel object. This is typically called on the server before a page is served in order to get initial values for bound components.

hasData

ClientMethod hasData() [ Language = javascript ]

Return true if this controller currently contains data.

onloadHandler

ClientMethod onloadHandler() [ Language = javascript ]

This client event, if present, is fired when the page is loaded.

findObjectValue

ClientMethod findObjectValue(data, prop) [ Internal, Language = javascript ]

Decode a reference to a property within the given data and return its value.

setObjectValue

ClientMethod setObjectValue(data, prop, value) [ Internal, Language = javascript ]

Decode a reference to a property within the given data and set its value.

isArray

ClientMethod isArray(obj) [ Internal, Language = javascript ]

Internal method. Test if an object is an array.

save

ClientMethod save() [ Language = javascript ]

Save data from this dataController back to the DataModel on the server. Return the id with which the model was saved or '' if it was not saved.

getContentArray

ClientMethod getContentArray() [ Internal, Language = javascript ]

Return the array within the content object that supplies the values to a dataView.

%WriteJSONFromArray

ClassMethod %WriteJSONFromArray(pVar As %String = "", pClass As %String = "", pArrayMethod As %String = "", ByRef pParms As %String, pReturnStatus As %Boolean = 0, pFormat As %String) As %String

Utility method to allow direct use of JSON from a non-ZEN context (such as a CSP page).
Calls the class method pArrayMethod within the class pClass and converts the resulting array to an array of objects in JSON format using the convention of the OnGetArray callback.
The JSON notation is written out to the current device.
pVar is the optional name of the client-side Javascript variable that refers to the JSON notation.
pParms is an optional array of parameter names and values that is passed to the callback method.
pReturnStatus is a flag to control whether the status code from the method should be returned to the caller. If pReturnStatus is 0, an alert will be raised via Javascript. If pReturnStatus is 1, the status code will be used as the return value from the method and an alert will NOT be raised.
pFormat is a flags string that controls output formatting options.
The following character option codes are supported:
1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
a - output null arrays/objects
e - output empty object properties
i - indent with 4 spaces unless 't' or 1-9
l - output empty lists
n - newline (lf)
o - output empty arrays/objects
s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
t - indent with tab character
u - output pre-converted to UTF-8 instead of in native internal format
w - Windows-style cr/lf newline
From a CSP page, you could invoke the method as follows:
#(##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONFromArray("json",$classname(),"GetArray"))#

%WriteJSONFromObject

ClassMethod %WriteJSONFromObject(pVar As %String = "", pClass As %String = "", pMethod As %String = "", ByRef pParms As %String, pReturnStatus As %Boolean = 0, pFormat As %String) As %String

Utility method to allow direct use of JSON from a non-ZEN context (such as a CSP page).
Calls the class method pMethod within the class pClass and converts the resulting object to JSON format using the convention of the OnGetTargetObject callback.
The JSON notation is written out to the current device.
pVar is the optional name of the client-side Javascript variable that refers to the JSON notation.
pParms is an optional array of parameter names and values that is passed to the callback method.
pReturnStatus is a flag to control whether the status code from the method should be returned to the caller. If pReturnStatus is 0, an alert will be raised via Javascript. If pReturnStatus is 1, the status code will be used as the return value from the method and an alert will NOT be raised.
pFormat is a flags string that controls output formatting options.
The following character option codes are supported:
1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
a - output null arrays/objects
b - line break before opening { of objects
c - output the ObjectScript-specific "_class" and "_id" properties
d - output numeric properties that have value "" as null
e - output empty object properties
i - indent with 4 spaces unless 't' or 1-9
l - output empty lists
n - newline (lf)
o - output empty arrays/objects
q - output numeric values unquoted even when they come from a non-numeric property
s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
t - indent with tab character
u - output pre-converted to UTF-8 instead of in native internal format
w - Windows-style cr/lf newline
From a CSP page, you could invoke the method as follows:
#(##class(%ZEN.Auxiliary.jsonProvider).%WriteJSONFromObject("json",$classname(),"GetObject"))#

%ConvertJSONToObject

ClassMethod %ConvertJSONToObject(pContent As %String, pTargetClass As %String = "", Output pObject As %RegisteredObject, pIgnoreUnknownProps As %Boolean = 0) As %Status [ CodeMode = expression ]

Utility method to allow direct use of JSON from a non-ZEN context (such as a CSP page).
pContent is a string or a stream containing JSON notation.
pTargetClass is an optional class type for the resulting object; if not provided, %ZEN.proxyObject is used.
pObject is the object created from the the JSON. pIgnoreUnknownProps controls whether properties that are not defined in the object structure will be ignored or treated as an error condition. The default behaviour is to stop processing the incoming JSON.

%WriteJSONStreamFromArray

ClassMethod %WriteJSONStreamFromArray(pStream As %Stream.Object, pClass As %String, pArrayMethod As %String, ByRef pParms As %String, pRewindStream As %Boolean = 0, pFormat As %String) As %Status [ ProcedureBlock = 0 ]

Utility method to allow JSON output to be written to a stream from a general non-ZEN context.
Calls the class method pArrayMethod within the class pClass and converts the resulting array to an array of objects in JSON format using the convention of the OnGetArray callback.
The JSON notation is written out to the stream supplied in pStream.
pParms is an optional array of parameter names and values that is passed to the callback method.
pRewindStream is a flag to control whether the stream should be rewound after the data is written to it.
pFormat is a flags string to control output formatting options.
The following character option codes are supported:
1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
a - output null arrays/objects
e - output empty object properties
i - indent with 4 spaces unless 't' or 1-9
l - output empty lists
n - newline (lf)
o - output empty arrays/objects
s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
t - indent with tab character
u - output pre-converted to UTF-8 instead of in native internal format
w - Windows-style cr/lf newline

%WriteJSONStreamFromObject

ClassMethod %WriteJSONStreamFromObject(pStream As %Stream.Object, pObject As %String, pMethod As %String, ByRef pParms As %String, pRewindStream As %Boolean = 0, pFormat As %String) As %Status [ ProcedureBlock = 0 ]

Utility method to allow JSON output to be written to a stream from a general non-ZEN context.
Calls the class method pMethod within the class pClass and converts the resulting object to JSON format using the convention of the OnGetTargetObject callback. However, if an object is supplied in pClass, then the supplied object will be used as the source object.
The JSON notation is written out to the stream supplied in pStream.
pParms is an optional array of parameter names and values that is passed to the callback method. If pClass is an object, these parameters will be ignored.
pRewindStream is a flag to control whether the stream should be rewound after the data is written to it.
pFormat is a flags string to control output formatting options.
The following character option codes are supported:
1-9 : indent with this number of spaces (4 is the default with the 'i' format specifier)
a - output null arrays/objects
b - line break before opening { of objects
c - output the ObjectScript-specific "_class" and "_id" properties
d - output numeric properties that have value "" as null
e - output empty object properties
i - indent with 4 spaces unless 't' or 1-9
l - output empty lists
n - newline (lf)
o - output empty arrays/objects
q - output numeric values unquoted even when they come from a non-numeric property
s - use strict JSON output - NOTE: special care should be taken when sending data to a browser, as using this flag may expose you to cross site scripting (XSS) vulnerabilities if the data is sent inside <script> tags. Zen uses this technique extensively, so this flag should NOT be specified for jsonProviders in Zen pages.
t - indent with tab character
u - output pre-converted to UTF-8 instead of in native internal format
w - Windows-style cr/lf newline

redirects

ClassMethod redirects() [ Internal, Private, ProcedureBlock = 0 ]

getSuperClassList

ClassMethod getSuperClassList(pClass As %String, ByRef pList As %String, ByRef pSkip As %String, ByRef pSkipPackage As %String) [ Internal ]

Build a list of super classes (indexed by number) starting from (and including) pClass. Stop when any of the classes in the list pSkip are reached. Skip any classes in any of the packages in the list pSkipPackage are reached.

getOrderedProps

ClassMethod getOrderedProps(pClass As %Dictionary.CompiledClass, ByRef pList) [ Internal ]

Build a list of properties in sequence order, including inherited properties.
On return, pList is a list of properties names (subscripted by order number).