JSON.GetArrayItems
------------------

Queries entries from JSON array.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [JSON](component_JSON.md) | [10.4](newinversion104.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "JSON.GetArrayItems"; JSON ) 

**MBS**( **"JSON.GetArrayItems";** /\* Queries entries from JSON array. \*/  
**$JSON**) /\* A JSON text or reference.e.g. "\[1,2,3\]" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | "\[1,2,3\]" |

### Result

Returns list or error.

### Description

Queries entries from JSON array.  
Returns list of reference numbers for JSON objects.  
Performance is better than FileMaker native once array is big enough.  
### Examples

Loop over JSON array items:

 # get some huge JSON array   
Set Variable \[ $json ; Value: "\[\\"Hello\\", \\"World\\"\]" \]   
\# Create list of JSON reference numbers   
Set Variable \[ $list ; Value: MBS ( "JSON.GetArrayItems"; $json ) \]   
If \[ MBS ("IsError") = 0 \]   
 # loop over list  
 Set Variable \[ $count ; Value: ValueCount($list ) \]   
 If \[ $count &gt; 0 \]   
 Set Variable \[ $index ; Value: 1 \]   
 If \[ $index ≤ $count \]   
 Loop  
 # your script steps here  
 Set Variable \[ $j ; Value: GetValue($list ; $index ) \]   
 Show Custom Dialog \[ "JSON item" ; MBS ("[JSON.Format](JSONFormat.md)"; $j ) \]   
 #   
 # next  
 Set Variable \[ $index ; Value: $index + 1 \]   
 Exit Loop If \[ $index &gt; $count \]   
 End Loop  
 End If  
 End If  
 # free them all  
 Set Variable \[ $r ; Value: MBS ("[JSON.Release](JSONRelease.md)"; $list ) \]   
End If  
### See also

- [IsError](IsError.md)
- [JSON.Format](JSONFormat.md)
- [JSON.GetArrayItem](JSONGetArrayItem.md)
- [JSON.GetArrayItemsAsList](JSONGetArrayItemsAsList.md)
- [JSON.GetArrayItemsAsQuickList](JSONGetArrayItemsAsQuickList.md)
- [JSON.GetArrayPathItems](JSONGetArrayPathItems.md)
- [JSON.GetArraySize](JSONGetArraySize.md)
- [JSON.Release](JSONRelease.md)
- [QuickList.JoinJSON](QuickListJoinJSON.md)
- [XML.ItemRefs](XMLItemRefs.md)

### Release notes

- **Version 14.4**
    - Changed [JSON.GetArrayItemsAsList](https://www.mbsplugins.eu/JSONGetArrayItemsAsList.shtml) to return empty result if JSON is empty.
- **Version 13.3**
    - Added [JSON.GetArrayItemsAsQuickList](https://www.mbsplugins.eu/JSONGetArrayItemsAsQuickList.shtml) and [QuickList.JoinJSON](https://www.mbsplugins.eu/QuickListJoinJSON.shtml) functions.
- **Version 10.4**
    - Added [JSON.GetArrayItems](https://www.mbsplugins.eu/JSONGetArrayItems.shtml) function to work with huge JSON arrays.
- **Version 8.3**
    - Fixed crash in [JSON.GetArrayItemsAsList](http://www.mbsplugins.eu/JSONGetArrayItemsAsList.shtml) for undefined values.
- **Version 8.1**
    - Added ReturnValues parameter for [JSON.GetArrayItemsAsList](http://www.mbsplugins.eu/JSONGetArrayItemsAsList.shtml) function.

### Blog Entries

- [What is new in the MBS FileMaker Plugin Version 10.4](https://www.mbsplugins.de/archive/2020-09-22/What_is_new_in_the_MBS_FileMak/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.4pr5](https://www.mbsplugins.de/archive/2020-08-24/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 22nd August 2020 , last changed 22nd August 2020

  
[JSON.GetArrayItem](JSONGetArrayItem.md) - [JSON.GetArrayItemsAsList](JSONGetArrayItemsAsList.md)

[HTML Version](JSONGetArrayItems.shtml)