JsonCircularReference class: Difference between revisions
m (misc cleanup) |
m (remove paragraph) |
||
Line 3: | Line 3: | ||
<var>JsonCircularReference</var> [[Exceptions|exceptions]] are thrown by the <var>[[Stringify (Json function)|Stringify]]</var> function in the <var>[[Json class|Json]]</var> class if the <var>Json</var> object leads to a [[Json class#Circular references|circular reference]]. | <var>JsonCircularReference</var> [[Exceptions|exceptions]] are thrown by the <var>[[Stringify (Json function)|Stringify]]</var> function in the <var>[[Json class|Json]]</var> class if the <var>Json</var> object leads to a [[Json class#Circular references|circular reference]]. | ||
The <var>JsonCircularReference</var> class, like the <var>Json</var> class, is available as of <var class="product">Model 204</var> 7.6. | The <var>JsonCircularReference</var> class, like the <var>Json</var> class, is available as of <var class="product">Model 204</var> 7.6. | ||
Latest revision as of 00:44, 13 May 2015
JsonCircularReference exceptions are thrown by the Stringify function in the Json class if the Json object leads to a circular reference.
The JsonCircularReference class, like the Json class, is available as of Model 204 7.6.
The JsonCircularReference methods
The following are the available JsonCircularReference class methods.
Method | Description |
---|---|
New | Create a new JsonCircularReference object |
The methods in the class are described in the subsections that follow. In addition:
- Notation conventions for methods has information about the conventions followed.
- JsonCircularReference methods syntax is a single page that contains the syntax diagrams of all the methods in the class.
New constructor
Create a new JsonCircularReference object (JsonCircularReference class)
This Constructor generates an instance of a JsonCircularReference exception. The New method format is as follows:
Syntax
%jsonCircularReference = [%(JsonCircularReference):]New
Syntax terms
%JsonCircularReference | A reference to an instance of a JsonCircularReference object. |
---|---|
[%(JsonCircularReference):] | The class name in parentheses denotes a Constructor. |
Usage notes
The following example catches a circular reference exception and prints the string where the circular reference occurs.
b %jsonCircRefError is object JsonCircularReference %jsa is object json %jsb is object json %jsc is object json %jsa = array('a') %jsb = array('b') %jsc = array('c') %jsa:add(%jsb) %jsb:add(%jsc) %jsc:add(%jsa) try print %jsa:stringify catch JsonCircularReference to %jsonCircRefError print 'Caught Json Circular Reference Error' print %jsa:tostring end try end
Running this example results in:
Caught Json Circular Reference Error ["a",["b",["c",[Circular]]]]