JSON.AddNumberToObject
----------------------

Adds a new entry to the object with the given name and value.

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

MBS( "JSON.AddNumberToObject"; JSON; Name...; Value... ) 

**MBS**( **"JSON.AddNumberToObject";** /\* Adds a new entry to the object with the given name and value. \*/  
**$JSON**; /\* A JSON text or reference.e.g. {"key":"value"} \*/   
**$Name...**; /\* The name of the Object property.e.g. "length" \*/   
**$Value...**) /\* The number value to add.e.g. 123.45 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| JSON | A JSON text or reference. | {"key":"value"} |
| Name... | The name of the Object property. | "length" |
| Value... | The number value to add. | 123.45 |

### Result

Returns JSON code.

### Description

Adds a new entry to the object with the given name and value.  
  
With version 6, you can pass several parameters to add several entries to the object.  
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 Name and Value parameters as often as you need.  
### Examples

Adds two number entries to an object:

 MBS ( "JSON.AddNumberToObject"; "{}"; "hello"; 1; "test"; 5)  
<small>  
Example result:   
{ "hello" : 1 , "test" : 5 } </small>Adds number:

 MBS ( "JSON.AddNumberToObject"; "{}"; "test"; 123 )  
<small>  
Example result:   
{ "test" : 123 } </small>Add big number:

 MBS ( "JSON.AddNumberToObject"; "{}"; "zahl"; 12063660878882855000013426248015578834577 )  
<small>  
Example result:   
{ "zahl" : 12063660878882855000013426248015578834577 } </small>### See also

- [JSON.AddBooleanToObject](JSONAddBooleanToObject.md)
- [JSON.AddFalseToObject](JSONAddFalseToObject.md)
- [JSON.AddItemToObject](JSONAddItemToObject.md)
- [JSON.AddNullToObject](JSONAddNullToObject.md)
- [JSON.AddNumberToArray](JSONAddNumberToArray.md)
- [JSON.AddStringToObject](JSONAddStringToObject.md)
- [JSON.AddValueToObject](JSONAddValueToObject.md)
- [JSON.CreateArrayRef](JSONCreateArrayRef.md)
- [MapView.Snapshot](MapViewSnapshot.md)
- [SQL.SetParamsWithJSON](SQLSetParamsWithJSON.md)

### Release notes

- **Version 16.2**
    - Changed [JSON.AddValueToObject](https://www.mbsplugins.eu/JSONAddValueToObject.shtml), [JSON.AddItemToObject](https://www.mbsplugins.eu/JSONAddItemToObject.shtml) and [JSON.AddNumberToObject](https://www.mbsplugins.eu/JSONAddNumberToObject.shtml) to replace existing items instead of adding a duplicate.
- **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.

### Example Databases

- [CURL/WebServices/CURL FMS Admin API v17](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/WebServices/CURL%20FMS%20Admin%20API%20v17.shtml#28ScriptAnchor_)
- [Mac and iOS/MapKit/MapKit Snapshots](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Mac%20and%20iOS/MapKit/MapKit%20Snapshots.shtml#1ScriptAnchor_)
- [SQL to other databases/SQLite fun](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/SQL%20to%20other%20databases/SQLite%20fun.shtml#5ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.2pr5](https://www.mbsplugins.de/archive/2026-05-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 15 - vCard QR](https://www.mbsplugins.de/archive/2024-12-15/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Advent calendar - Door 11 - Know Your Way](https://www.mbsplugins.de/archive/2024-12-11/MBS_FileMaker_Advent_calendar_/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.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)

### FileMaker Magazin

- [Ausgabe 3/2022, Seite 26 bis 27](https://filemaker-magazin.de/neuigkeit/4187-Appetithappen-FMM_202203)
- [Ausgabe 3/2022, Seite 24](https://filemaker-magazin.de/neuigkeit/4187-Appetithappen-FMM_202203)

This function checks for a license.

Created 18th August 2014 , last changed 5th June 2021

  
[JSON.AddNumberToArray](JSONAddNumberToArray.md) - [JSON.AddStringToArray](JSONAddStringToArray.md)

[HTML Version](JSONAddNumberToObject.shtml)