# For Each Json Loop

Iterates over all elements (Key-Value pairs) in the specified Json object, assigning the current dictionary element to the variables specified in the Key and Value properties during each iteration of the loop. The script execution then continues towards the exit Element of this block (into the so-called "loop body").

After iterating through all elements of the Dictionary, the script execution continues towards the lower exit of the block. Don't forget to connect the exit of the last block in the loop body to the entry of this block.

<table data-header-hidden><thead><tr><th width="258" valign="top"></th><th width="311" valign="top"></th></tr></thead><tbody><tr><td valign="top">Json Object</td><td valign="top"><p>[Object] The Json object to iterate over.</p><p>You can obtain the object using the "Convert JSON to Object" block with the "Alternative Method" property enabled.</p></td></tr><tr><td valign="top">Name</td><td valign="top">[Text] The name of the Json field.</td></tr><tr><td valign="top">Value</td><td valign="top">[Any type] The value of the Json field.</td></tr><tr><td valign="top">Element Index</td><td valign="top">[Number] The ordinal number of the element. Numbering starts from zero.</td></tr><tr><td valign="top">If Array</td><td valign="top">[Boolean] Indicates that the value of the current element is an array. In this case, the For Each Loop (List) block can be used.</td></tr><tr><td valign="top">If Object</td><td valign="top">[Boolean] Indicates that the value of the current element is an object. In this case, the same block can be used to iterate over the values of this object.</td></tr><tr><td valign="top">Error Handling Level</td><td valign="top"><p>Select the error handling level. Possible values:</p><ul><li>"Default" - default;</li><li>"Ignore" - errors are ignored;</li><li>"Handle" - errors are handled.</li></ul><p>If "Default" is selected, the value of the "Start" block of this diagram will be used.</p></td></tr><tr><td valign="top">Exit Direction</td><td valign="top"><p>Select the exit direction from the block in case of an error. Possible values:</p><ul><li>"Default" - default;</li><li>"Right" - to the right;</li><li>"Bottom" - down.</li></ul><p>This property allows you to determine the exit direction in case of errors for blocks that do not contain the "If Error" connector (for example, the "Condition" block).</p><p>If "Default" is selected, the value of the "Start" block of this diagram will be used.</p></td></tr><tr><td valign="top">Message Level</td><td valign="top"><p>Select the message level that blocks will output during operation. Possible values:</p><ul><li>"Default" - default;</li><li>"Release" - output disabled;</li><li>"Debug" - main information output;</li><li>"Detailed" - detailed information output.</li></ul><p>If "Default" is selected, the value of the "Start" block of this diagram will be used.</p></td></tr><tr><td valign="top">Error Text</td><td valign="top">[Text] Returns detailed information about the error in case of incorrect execution of the block's work.</td></tr></tbody></table>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sherparpa.ru/en/sherpa-rpa/sherpa-designer/spravochnik-blokov/tekst-string-automation/cikl-dlya-kazhdogo-json-foreachjson.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
