JSON.FindValueInArray
---------------------

Queries index of value in array.

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

MBS( "JSON.FindValueInArray"; JSON; Find { ; Flags; StartIndex } ) 

**MBS**( **"JSON.FindValueInArray";** /\* Queries index of value in array. \*/  
**$JSON**; /\* A JSON text or reference.e.g. {"key": "value"} \*/   
**$Find**; /\* A JSON text or reference to find.e.g. {"key": "value"} \*/   
**$Flags**; /\* Optional; The sum of the flags below. Default is 0 for none.  
  
FindAll and MatchSubstring are new in version 15.4.e.g. 0 \*/   
**$StartIndex**) /\* Optional; Index of first element to check.  
Zero if not specified.  
If you like to continue searching, you can pass last result + 1.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| JSON | A JSON text or reference. | {"key": "value"} |  |
| Find | A JSON text or reference to find. | {"key": "value"} |  |
| Flags | The sum of the flags below. Default is 0 for none.      FindAll and MatchSubstring are new in version 15.4. | 0 | Optional |
| StartIndex | Index of first element to check.   Zero if not specified.   If you like to continue searching, you can pass last result + 1. | 0 | Optional      Added in version **11.5**. |

### Result

Returns index or error.

### Description

Queries index of value in array.  
Returns zero based index or -1 if not found.  
  
| Flag | Value | Description |
|---|---|---|
| ByContent | 1 | Compare JSON by content, so number can be found via text. Default is off, so type counts first. |
| FindAll | 2 | Return a list of indexes instead of just the first one. |
| MatchSubstring | 4 | Match text only by substring instead of whole item. |

  
Version 10.0 or newer finds optionally by content, so number can be found via text.  
### Examples

Find value in an array of numbers:

 MBS ( "JSON.FindValueInArray"; "\[5,6,7,1,4,3,7\]"; 3)  
<small>  
Example result: 5</small>Find text:

 MBS ( "JSON.FindValueInArray"; "\[\\"Hello\\", \\"World\\", \\"Test\\"\]"; "\\"World\\"")  
<small>  
Example result: 1</small>Find objects:

 MBS ( "JSON.FindValueInArray"; "\[{\\"Hello\\":123}, {\\"World\\":234}, {\\"Test\\":345}\]"; "{\\"World\\":234}")  
<small>  
Example result: 1</small>Find the apple:

 MBS ( "JSON.FindValueInArray";   
// some json with an emoji  
"\[\\"Test\\",\\"🍎\\",\\"Other\\"\]";   
// and we can find it with unicode escape (or by passing the emoji again)  
"\\"\\uD83C\\uDF4E\\"")  
<small>  
Example result: 1</small>Find all positions of 3:

 MBS ( "JSON.FindValueInArray"; "\[5,6,3,7,1,4,3,7\]"; 3; 2)  
<small>  
Example result:   
2  
6</small>### See also

- [JSON.AddValueToArray](JSONAddValueToArray.md)
- [JSON.FindValueInObjectArray](JSONFindValueInObjectArray.md)

### Release notes

- **Version 15.4**
    - Added flags for [JSON.FindValueInArray](https://www.mbsplugins.eu/JSONFindValueInArray.shtml) and [JSON.FindValueInObjectArray](https://www.mbsplugins.eu/JSONFindValueInObjectArray.shtml) functions.
- **Version 11.5**
    - Added StartIndex parameter to [JSON.FindValueInArray](https://www.mbsplugins.eu/JSONFindValueInArray.shtml) and [JSON.FindValueInObjectArray](https://www.mbsplugins.eu/JSONFindValueInObjectArray.shtml) functions, so you can repeat search until nothing more is found.
- **Version 10.0**
    - Added parameter to [JSON.FindValueInArray](https://www.mbsplugins.eu/JSONFindValueInArray.shtml) and [JSON.FindValueInObjectArray](https://www.mbsplugins.eu/JSONFindValueInObjectArray.shtml) to compare by content.
- **Version 9.0**
    - Added [JSON.CreateValue](http://www.mbsplugins.eu/JSONCreateValue.shtml), [JSON.Equals](http://www.mbsplugins.eu/JSONEquals.shtml), [JSON.FindValueInArray](http://www.mbsplugins.eu/JSONFindValueInArray.shtml) and [JSON.FindValueInObjectArray](http://www.mbsplugins.eu/JSONFindValueInObjectArray.shtml) functions.

### Blog Entries

- [MBS FileMaker Plugin, version 15.4pr1](https://www.mbsplugins.de/archive/2025-08-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.5pr2](https://www.mbsplugins.de/archive/2021-10-11/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 10.0pr8](https://www.mbsplugins.de/archive/2020-01-11/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)
- [MBS FileMaker Plugin, version 8.6pr4](https://www.mbsplugins.de/archive/2018-12-18/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2020, Seite 17](https://filemaker-magazin.de/neuigkeit/4110-Appetithappen-FMM_202005)

This function checks for a license.

Created 14th December 2018 , last changed 23th July 2025

  
[JSON.FilterObjectArray](JSONFilterObjectArray.md) - [JSON.FindValueInObjectArray](JSONFindValueInObjectArray.md)

[HTML Version](JSONFindValueInArray.shtml)