Home > Class Reference > %SYS namespace > %JSON.Formatter

%JSON.Formatter

class %JSON.Formatter extends %Library.RegisteredObject

%JSON.Formatter implements the ability to format JSON documents which are expressed as strings, text or dynamic objects.

Property Inventory

Method Inventory

Properties

property Indent as %Boolean [ InitialExpression = 1 ];
Indent specifies that indentation of the JSON output should take place.
Property methods: IndentCharsDisplayToLogical(), IndentCharsGet(), IndentCharsIsValid(), IndentCharsLogicalToDisplay(), IndentCharsLogicalToOdbc(), IndentCharsNormalize(), IndentCharsSet(), IndentDisplayToLogical(), IndentGet(), IndentIsValid(), IndentLogicalToDisplay(), IndentNormalize(), IndentSet()
property IndentChars as %String [ InitialExpression = " " ];
IndentChars specifies the character sequence to be used for each indent level if Indent=1.
Property methods: IndentCharsDisplayToLogical(), IndentCharsGet(), IndentCharsIsValid(), IndentCharsLogicalToDisplay(), IndentCharsLogicalToOdbc(), IndentCharsNormalize(), IndentCharsSet()
property LineTerminator as %String [ InitialExpression = $char(13,10) ];
LineTerminator specifies the character sequence to terminate each line when indenting.
Property methods: LineTerminatorDisplayToLogical(), LineTerminatorGet(), LineTerminatorIsValid(), LineTerminatorLogicalToDisplay(), LineTerminatorLogicalToOdbc(), LineTerminatorNormalize(), LineTerminatorSet()

Methods

method Format(input) as %Status [ Language = objectscript ]
Format a JSON document using the specified indentation and write it to the current device.
The input argument is either JSON as a string or stream, or a subclass of %DynamicAbstractObject.
method FormatToStream(input, ByRef export As %Stream.Object) as %Status [ Language = objectscript ]
Format a JSON document using the specified indentation and write it to a stream.
The input argument is either JSON as a string or stream, or a subclass of %DynamicAbstractObject.
method FormatToString(input, ByRef export As %String = "") as %Status [ Language = objectscript ]
Format a JSON document using the specified indentation and write it to a string.
Serialize a JSON enabled class as a JSON document and return it as a string.

Inherited Methods