JSON.ReplaceItemInArray
-----------------------

Replaces an item in an array with new item.

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

MBS( "JSON.ReplaceItemInArray"; JSON; Index; json2 ) 

**MBS**( **"JSON.ReplaceItemInArray";** /\* Replaces an item in an array with new item. \*/  
**$JSON**; /\* A JSON text or reference.e.g. "\[1,2,3,4\]" \*/   
**$Index**; /\* The index of the array item.e.g. 2 \*/   
**$json2**) /\* The new json item for the array.e.g. 5 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | "\[1,2,3,4\]" |
| Index | The index of the array item. | 2 |
| json2 | The new json item for the array. | 5 |

### Result

Returns JSON code.

### Description

Replaces an item in an array with new item.  
### Examples

Replace a value in array:

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

- [JSON.Replace](JSONReplace.md)
- [JSON.ReplaceItemInObject](JSONReplaceItemInObject.md)

### Blog Entries

- [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 4.3pr8](https://www.mbsplugins.de/archive/2014-09-02/MBS_Filemaker_Plugin_version_4/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 26th August 2014 , last changed 11st December 2016

  
[JSON.ReplaceEvaluate](JSONReplaceEvaluate.md) - [JSON.ReplaceItemInObject](JSONReplaceItemInObject.md)

[HTML Version](JSONReplaceItemInArray.shtml)