Skip to main content

HS.REST.Model.ISerializable

class HS.REST.Model.ISerializable extends %Library.RegisteredObject, %pkg.isc.json.adaptor, %pkg.isc.rest.model.iSerializable

Interface for JSON-serializable/deserializable objects.
For HS, by default use %pkg.isc.json.adaptor.

Method Inventory

Parameters

parameter %JSONFIELDNAMEASCAMELCASE = 1;
%JSONFIELDNAMEASCAMELCASE auto-generates the %JSONFIELDNAME for properties (if not specified) as camelCase.
parameter %JSONIGNOREINVALIDFIELD = 1;
The %JSONIGNOREINVALIDFIELD parameter allows the programmer to control handling of unexpected fields in the JSON input. The default (%JSONIGNOREINVALIDFIELD = 0) will treat an unexpected field as an error. If %JSONIGNOREINVALIDFIELD is set = 1, then unexpected fields will be ignored.
NEED to have this field set to 1 by default for cross version compatibility. Say for example, a subclass of this is available on a client and server instance and the client instance has a higher version. Then when sending the payload of this class to the server, the client may have new properties that the server would not understand. These should be ignored and the response would then indicate the subset of properties that the server DOES understand so the client can react accordngly. Throwing an error instead is less helpful.

Methods

method JSONExport() as %Status
Serialize a JSON enabled class as a JSON document and write it to the current device.
method JSONExportToStream(ByRef export As %Stream.Object) as %Status
Serialize a JSON enabled class as a JSON document and write it to a stream.
method JSONExportToString(ByRef export As %String) as %Status
Serialize a JSON enabled class as a JSON document and return it as a string.
method JSONImport(input) as %Status
JSONImport imports JSON or dynamic object input into this object.
The input argument is either JSON as a string or stream, or a subclass of %DynamicAbstractObject.

Inherited Members

Inherited Methods

Subclasses

FeedbackOpens in a new tab