Difference between revisions of "System.JSON.TJSONArray.TEnumerator"

From RAD Studio API Documentation
Jump to: navigation, search
(Created page with "{{#lst:API:System.JSON.TJSONArray.TEnumerator|api}} ==Description== {{#lsth:API:System.JSON.TJSONArray.TEnumerator|Description}}")
 
(RS-95365)
 
Line 1: Line 1:
 
{{#lst:API:System.JSON.TJSONArray.TEnumerator|api}}
 
{{#lst:API:System.JSON.TJSONArray.TEnumerator|api}}
 
==Description==
 
==Description==
{{#lsth:API:System.JSON.TJSONArray.TEnumerator|Description}}
+
{{#ifeq: {{PAGENAME}} | System.JSON.TJSONArray.TEnumerator | |{{InheritsFrom|System.JSON.TJSONArray.TEnumerator}}}}
 +
 
 +
<section begin=short />Iterator for [[System.JSON.TJSONArray.Items|items]] of [[System.JSON.TJSONArray|JSON arrays]].<section end=short />
 +
 
 +
To use an iterator to iterate a [[System.JSON.TJSONArray|TJSONArray]] object, call [[System.JSON.TJSONArray.GetEnumerator|GetEnumerator]] from the JSON array object to create a [[System.JSON.TJSONArray.TEnumerator|TEnumerator]] iterator, and use [[System.JSON.TJSONArray.TEnumerator.MoveNext|MoveNext]] and [[System.JSON.TJSONArray.TEnumerator.Current|Current]] to iterate through the [[System.JSON.TJSONValue|JSON values]] of the JSON array:
 +
<l s="delphi" />
 +
'''{{Delphi}}:'''
 +
<source lang="delphi">
 +
MyJSONArrayIterator := TEnumerator.Create(MyJSONArray);
 +
while MyJSONArrayIterator.MoveNext do
 +
begin
 +
    MyJSONValue := MyJSONArrayIterator.Current;
 +
    // …
 +
end;
 +
</source>
 +
<l e="delphi" />
 +
<l s="cpp" />
 +
'''C++:'''
 +
<source lang="cpp">
 +
TEnumerator* MyJSONArrayIterator = new TEnumerator(MyJSONArray);
 +
while (MyJSONArrayIterator->MoveNext())
 +
{
 +
    TJSONValue* MyJSONValue = MyJSONArrayIterator->Current;
 +
    // …
 +
}
 +
</source>
 +
<l e="cpp" />
 +
 
 +
===See Also ===
 +
 
 +
* [[System.JSON.TJSONArray]]
 +
* [[System.JSON.TJSONArray.GetEnumerator]]
 +
* [[System.JSON.TJSONArray.TEnumerator.Current]]
 +
* [[System.JSON.TJSONArray.TEnumerator.MoveNext]]
 +
* [[System.JSON.TJSONValue]]
 +
 
 +
[[Category:API Documentation]]
 +
[[Category:XE2]]

Latest revision as of 22:11, 25 May 2021

Delphi

TEnumerator = class

C++

class PASCALIMPLEMENTATION TEnumerator : public System::TObject

Properties

Type Visibility Source Unit Parent
class public
System.JSON.pas
System.JSON.hpp
System.JSON TJSONArray

Description

Iterator for items of JSON arrays.

To use an iterator to iterate a TJSONArray object, call GetEnumerator from the JSON array object to create a TEnumerator iterator, and use MoveNext and Current to iterate through the JSON values of the JSON array:

Delphi:

MyJSONArrayIterator := TEnumerator.Create(MyJSONArray);
while MyJSONArrayIterator.MoveNext do
begin
    MyJSONValue := MyJSONArrayIterator.Current;
    // …
end;

C++:

TEnumerator* MyJSONArrayIterator = new TEnumerator(MyJSONArray);
while (MyJSONArrayIterator->MoveNext())
{
    TJSONValue* MyJSONValue = MyJSONArrayIterator->Current;
    // …
}

See Also