JSON.GetArrayItem
-----------------

Queries entry from array with given index.

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

MBS( "JSON.GetArrayItem"; JSON; Index { ; Flags } ) 

**MBS**( **"JSON.GetArrayItem";** /\* Queries entry from array with given index. \*/  
**$JSON**; /\* A JSON text or reference.e.g. "\[1,2,3\]" \*/   
**$Index**; /\* The index of the array element.e.g. 0 \*/   
**$Flags**) /\* Optional; Pass various flags.  
0 returns as JSON text.  
1 returns as JSON reference number.  
2 returns as value.  
Default is 0.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| JSON | A JSON text or reference. | "\[1,2,3\]" |  |
| Index | The index of the array element. | 0 |  |
| Flags | Pass various flags.   0 returns as JSON text.   1 returns as JSON reference number.   2 returns as value.   Default is 0. | 0 | Optional |

### Result

Returns JSON code.

### Description

Queries entry from array with given index.  
Index is zero based.  
### Examples

Create array and pick second item:

 Let(  
\[  
j = MBS ( "[JSON.CreateDoubleArray](JSONCreateDoubleArray.md)"; 1; 2; 3);  
r = MBS ( "JSON.GetArrayItem"; j; 1 )  
\];  
r)  
### See also

- [FM.SQL.JSONRecords](FMSQLJSONRecords.md)
- [JSON.CreateDoubleArray](JSONCreateDoubleArray.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)
- [Text.Styles](TextStyles.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.5**
    - Added flags for [JSON.GetArrayItem](https://www.mbsplugins.eu/JSONGetArrayItem.shtml), so result can be JSON, reference or now value.
- **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.

### Example Databases

- [Barcode/Barcode Generation JSON](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Barcode%20Generation%20JSON.shtml#9ScriptAnchor_)
- [Barcode/Swiss QR-Code for invoices/Swiss QR-Code for invoices ISO 20022](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Barcode/Swiss%20QR-Code%20for%20invoices/Swiss%20QR-Code%20for%20invoices%20ISO%2020022.shtml#22ScriptAnchor_)
- [CURL/Email/IMAP Email List](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email%20List.shtml#1ScriptAnchor_)
- [CURL/Email/IMAP Email](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Email/IMAP%20Email.shtml#1ScriptAnchor_)
- [CURL/WebServices/WeatherBit.io test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/WeatherBit.io%20test.shtml#3ScriptAnchor_)
- [JSON/JSON Order Parsing](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/JSON/JSON%20Order%20Parsing.shtml#1ScriptAnchor_)
- [JSON/JSON Test](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/JSON/JSON%20Test.shtml#2ScriptAnchor_)
- [Mac and iOS/Machine Learning/Core Image Detection](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/Machine%20Learning/Core%20Image%20Detection.shtml#1ScriptAnchor_)
- [Mac only/ImageCapture/Camera Import](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20only/ImageCapture/Camera%20Import.shtml#5ScriptAnchor_)
- [Win Only/WindowsML](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Win%20Only/WindowsML.shtml#6ScriptAnchor_)

### Blog Entries

- [Create QR-Codes with circles](https://www.mbsplugins.de/archive/2025-02-13/Create_QR-Codes_with_circles/monkeybreadsoftware_blog_filemaker)
- [MQTT in FileMaker](https://www.mbsplugins.de/archive/2024-06-25/MQTT_in_FileMaker/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.5pr1](https://www.mbsplugins.de/archive/2020-10-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [With JSON in excellent form](https://www.mbsplugins.de/archive/2019-11-16/With_JSON_in_excellent_form/monkeybreadsoftware_blog_filemaker)
- [Face detection via CoreImage in FileMaker](https://www.mbsplugins.de/archive/2017-07-23/Face_detection_via_CoreImage_i/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 2/2025, Seite 23](https://filemaker-magazin.de/neuigkeit/4286-Appetithappen-FMM_202502)
- [Ausgabe 5/2020, Seite 18](https://filemaker-magazin.de/neuigkeit/4110-Appetithappen-FMM_202005)

This function checks for a license.

Created 18th August 2014 , last changed 27th September 2020

  
[JSON.FromToon](JSONFromToon.md) - [JSON.GetArrayItems](JSONGetArrayItems.md)

[HTML Version](JSONGetArrayItem.shtml)