Json methods syntax: Difference between revisions
(Automatically generated page update) |
(Automatically generated page update) |
||
(3 intermediate revisions by 3 users not shown) | |||
Line 2: | Line 2: | ||
replaced, so any manual edits will be lost. You've been warned. --> | replaced, so any manual edits will be lost. You've been warned. --> | ||
{{Template:Syntax list header|class=Json}} | {{Template:Syntax list header|class=Json}} | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top:1px solid;"><span class="squareb">[</span><span class="term">%number</span><span class="literal"> =</span><span class="squareb">]</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top:1px solid;"><span class="squareb">[</span><span class="term">%number</span><span class="literal"> =</span><span class="squareb">]</span> <span class="term">json</span><span class="literal">:[[Add (Json function)|Add]]</span><span class="literal">(</span> <span class="term" title="Json">json</span><span class="literal">)</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">% | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[Array (Json function)|Array]]</span><span class="squareb">[</span><span class="literal">(</span> <span class="squareb">[</span><span class="term" title="List">itemList</span><span class="squareb">]</span><span class="literal">)</span><span class="squareb">]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">% | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[Boolean (Json function)|Boolean]]</span><span class="literal">(</span> <span class="term" title="Boolean">boolean</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%boolean</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%boolean</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[BooleanValue (Json function)|BooleanValue]]</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outJson</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outJson</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[Copy (Json function)|Copy]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%count</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%count</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[Count (Json property)|Count]]</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outJson</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outJson</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[DeepCopy (Json function)|DeepCopy]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="squareb">[</span><span class="term">%number</span><span class="literal"> =</span><span class="squareb">]</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="squareb">[</span><span class="term">%number</span><span class="literal"> =</span><span class="squareb">]</span> <span class="term">json</span><span class="literal">:[[Delete (Json function)|Delete]]</span><span class="literal">(</span> <span class="term" title="%output">index</span><span class="literal">)</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">% | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[False (Json function)|False]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="squareb">[</span><span class="term">%number</span><span class="literal"> =</span><span class="squareb">]</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="squareb">[</span><span class="term">%number</span><span class="literal"> =</span><span class="squareb">]</span> <span class="term">json</span><span class="literal">:[[Insert (Json function)|Insert]]</span><span class="literal">(</span> <span class="term" title="Number">number</span><span class="comma">,</span> <span class="term" title="Json">json</span><span class="literal">)</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%currentJson</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%currentJson</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[Item (Json property)|Item]]</span><span class="literal">(</span> <span class="term" title="%output">index</span><span class="literal">)</span> | ||
<span class="term"> | <span class="term">json</span><span class="literal">:[[Item (Json property)|Item]]</span><span class="literal">(</span> <span class="term" title="%output">index</span><span class="literal">)</span> <span class="literal">= </span><span class="term">newJson</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outJson</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outJson</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[ItemByNumber (Json function)|ItemByNumber]]</span><span class="literal">(</span> <span class="term" title="Number">number</span><span class="literal">)</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[NameByNumber (Json function)|NameByNumber]]</span><span class="literal">(</span> <span class="term" title="Number">number</span><span class="literal">)</span> | ||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%Json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[Object (Json function)|Object]]</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[Number (Json function)|Number]]</span><span class="literal">(</span> <span class="term" title="Number">number</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">% | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%number</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[NumberByName (Json function)|NumberByName]]</span><span class="literal">(</span> <span class="term" title="Unicode">unicode</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%number</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[NumberValue (Json function)|NumberValue]]</span> | |||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[Object (Json function)|Object]]</span></p> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[Parse (Json function)|Parse]]</span><span class="literal">(</span> <span class="term" title="Unicode">unicode</span><span class="literal">)</span> | |||
Throws [[JsonParseError class|JsonParseError]]</p> | Throws [[JsonParseError class|JsonParseError]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">% | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[String (Json function)|String]]</span><span class="literal">(</span> <span class="term" title="Unicode">unicode</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term">Json</span><span class="literal">:[[StringValue (Json function)|StringValue]]</span> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[Stringify (Json function)|Stringify]]</span><span class="squareb">[</span><span class="literal">(</span> <span class="squareb">[</span><span class="literal" title="Number">Indent=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="literal">)</span><span class="squareb">]</span> | ||
Throws [[JsonCircularReference class|JsonCircularReference]]</p> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[StringValue (Json function)|StringValue]]</span> | |||
Throws [[InvalidJsonType class|InvalidJsonType]]</p> | Throws [[InvalidJsonType class|InvalidJsonType]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%unicode</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[ToString (Json function)|ToString]]</span><span class="squareb">[</span><span class="literal">(</span> <span class="squareb">[</span><span class="literal" title="Number">Indent=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="literal">)</span><span class="squareb">]</span> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">% | Throws [[JsonCircularReference class|JsonCircularReference]]</p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%jsonType</span><span class="literal"> =</span> <span class="term"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%json</span><span class="literal"> =</span> <span class="squareb">[</span><span class="literal">%(Json):</span><span class="squareb">]</span><span class="literal">[[True (Json function)|True]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%jsonType</span><span class="literal"> =</span> <span class="term">json</span><span class="literal">:[[Type (Json function)|Type]]</span></p> |
Latest revision as of 19:03, 15 August 2017
The syntax for each of the Json class methods is shown below.
Square brackets indicate optional elements of the method invocation. See also the notation conventions for methods and the List of Json methods.
[%number =] json:Add( json) Throws InvalidJsonType
%json = [%(Json):]Array[( [itemList])]
%json = [%(Json):]Boolean( boolean)
%boolean = json:BooleanValue Throws InvalidJsonType
%outJson = json:Copy
%count = json:Count Throws InvalidJsonType
%outJson = json:DeepCopy
[%number =] json:Delete( index) Throws InvalidJsonType
%json = [%(Json):]False
[%number =] json:Insert( number, json) Throws InvalidJsonType
%currentJson = json:Item( index) json:Item( index) = newJson Throws InvalidJsonType
%outJson = json:ItemByNumber( number) Throws InvalidJsonType
%unicode = json:NameByNumber( number) Throws InvalidJsonType
%json = [%(Json):]Number( number)
%number = json:NumberByName( unicode)
%number = json:NumberValue Throws InvalidJsonType
%json = [%(Json):]Object
%json = [%(Json):]Parse( unicode) Throws JsonParseError
%json = [%(Json):]String( unicode)
%unicode = json:Stringify[( [Indent= number])] Throws JsonCircularReference
%unicode = json:StringValue Throws InvalidJsonType
%unicode = json:ToString[( [Indent= number])] Throws JsonCircularReference
%json = [%(Json):]True
%jsonType = json:Type