JSON.AddNumberToArray
---------------------

Adds a number to an array.

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

MBS( "JSON.AddNumberToArray"; JSON; Value... ) 

**MBS**( **"JSON.AddNumberToArray";** /\* Adds a number to an array. \*/  
**$JSON**; /\* A JSON text or reference.e.g. \[1,2,3\] \*/   
**$Value...**) /\* The number to be addede.g. 5 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | \[1,2,3\] |
| Value... | The number to be added | 5 |

### Result

Returns JSON code or error.

### Description

Adds a number to an array.  
Same as [JSON.AddItemToArray](JSONAddItemToArray.md), but calls [JSON.CreateNumber](JSONCreateNumber.md) automatically for you.  
  
With version 6, you can pass several parameters to add several entries to the array.  
When adding to a JSON reference, the function returns that reference number.  
  
This function takes variable number of parameters. Pass as much parameters as needed separated by the semicolon in FileMaker.  
Please repeat Value parameter as often as you need.  
### Examples

Adds an item to array:

 MBS ( "[JSON.AddItemToArray](JSONAddItemToArray.md)"; "\[1,2,3\]"; 4)  
<small>  
Example result:   
\[1 , 2 , 3 , 4 \] </small>Add 4 numbers to an array:

 MBS ( "JSON.AddNumberToArray"; "\[\]"; 1; 2; 3; 4 )  
<small>  
Example result:   
\[1 , 2 , 3 , 4 \] </small>Add big number:

 MBS ( "JSON.AddNumberToArray"; "\[\]"; 12063660878882855000013426248015578834577 )  
<small>  
Example result:   
\[12063660878882855000013426248015578834577 \] </small>Use While loop to create JSON array:

 Let ( \[  
 // Create array object  
 j = MBS ( "[JSON.CreateArrayRef](JSONCreateArrayRef.md)" );  
 // make a loop to add numbers  
 r = While ( $i = 0 ; $i &lt; 10 ; \[ r = MBS ( "JSON.AddNumberToArray"; j; $i ); $i = $i + 1 \] ; $i );  
 // format the result  
 text = MBS ( "[JSON.Format](JSONFormat.md)"; j );  
 // free json  
 r = MBS ( "[JSON.Release](JSONRelease.md)"; j )  
\];  
// return result as text  
 text )  
### See also

- [JSON.AddItemToArray](JSONAddItemToArray.md)
- [JSON.AddNumberToObject](JSONAddNumberToObject.md)
- [JSON.AddStringToArray](JSONAddStringToArray.md)
- [JSON.AddValueToArray](JSONAddValueToArray.md)
- [JSON.CreateArray](JSONCreateArray.md)
- [JSON.CreateArrayRef](JSONCreateArrayRef.md)
- [JSON.CreateNumber](JSONCreateNumber.md)
- [JSON.Format](JSONFormat.md)
- [JSON.Release](JSONRelease.md)

### Release notes

- **Version 10.0**
    - Changed [JSON](https://www.mbsplugins.eu/component_JSON.shtml) functions to pass through floating numbers as is without rounding, in [JSON.CreateNumber](https://www.mbsplugins.eu/JSONCreateNumber.shtml), [JSON.AddNumberToArray](https://www.mbsplugins.eu/JSONAddNumberToArray.shtml) and others.
- **Version 8.2**
    - Improved [JSON.AddNumberToArray](http://www.mbsplugins.eu/JSONAddNumberToArray.shtml) and [JSON.AddNumberToObject](http://www.mbsplugins.eu/JSONAddNumberToObject.shtml) to handle large numbers better.

### Blog Entries

- [News about the MBS FileMaker Plugin 10.2](https://www.mbsplugins.de/archive/2020-05-19/News_about_the_MBS_FileMaker_P/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 9.6pr1](https://www.mbsplugins.de/archive/2019-12-02/MBS_FileMaker_Plugin_version_9/monkeybreadsoftware_blog_filemaker)
- [With JSON in excellent form](https://www.mbsplugins.de/archive/2019-11-16/With_JSON_in_excellent_form/monkeybreadsoftware_blog_filemaker)
- [Fun with While function in FileMaker](https://www.mbsplugins.de/archive/2019-07-22/Fun_with_While_function_in_Fil/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 8.2pr7](https://www.mbsplugins.de/archive/2018-05-14/MBS_FileMaker_Plugin_version_8/monkeybreadsoftware_blog_filemaker)
- [JSON with large integers](https://www.mbsplugins.de/archive/2018-05-11/JSON_with_large_integers/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 5th June 2021

  
[JSON.AddNullToObject](JSONAddNullToObject.md) - [JSON.AddNumberToObject](JSONAddNumberToObject.md)

[HTML Version](JSONAddNumberToArray.shtml)