Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.3
9.4
9.5
10.0
10.1
10.2
10.3
10.4
10.5
10.6
Statistic
FMM
Blog
JSON.AddNumberToArray
Adds a number to an array.
| Component | Version | macOS | Windows | Linux | Server | FileMaker iOS SDK |
| JSON | 4.3 | Yes | Yes | Yes | Yes | Yes |
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, but calls JSON.CreateNumber 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.
Examples
Adds an item to array:
MBS( "JSON.AddItemToArray"; "[1,2,3]"; 4)
Example result: [1, 2, 3, 4]
Add 4 numbers to an array:
MBS( "JSON.AddNumberToArray"; "[]"; 1; 2; 3; 4 )
Example result: [1, 2, 3, 4]
Add big number:
MBS( "JSON.AddNumberToArray"; "[]"; 12063660878882855000013426248015578834577 )
Example result: [12063660878882855000013426248015578834577]
Use While loop to create JSON array:
Let ( [
// Create array object
j = MBS( "JSON.CreateArrayRef" );
// make a loop to add numbers
r = While ( $i = 0 ; $i < 10 ; [ r = MBS( "JSON.AddNumberToArray"; j; $i ); $i = $i + 1 ] ; $i );
// format the result
text = MBS( "JSON.Format"; j );
// free json
r = MBS( "JSON.Release"; j )
];
// return result as text
text )
See also
- JSON.AddItemToArray
- JSON.AddNumberToObject
- JSON.AddStringToArray
- JSON.CreateArray
- JSON.CreateArrayRef
- JSON.CreateNumber
- JSON.Format
- JSON.Release
Blog Entries
- News about the MBS FileMaker Plugin 10.2
- MBS FileMaker Plugin, version 9.6pr1
- With JSON in excellent form
- Fun with While function in FileMaker
- MBS FileMaker Plugin, version 8.2pr7
- JSON with large integers
- MBS Filemaker Plugin, version 4.3pr8
FileMaker Magazin
Release notes
- Version 10.0
- Changed JSON functions to pass through floating numbers as is without rounding, in JSON.CreateNumber, JSON.AddNumberToArray and others.
- Version 8.2
- Improved JSON.AddNumberToArray and JSON.AddNumberToObject to handle large numbers better.
Created 26th August 2014, last changed 22nd July 2019
JSON.AddNullToObject - JSON.AddNumberToObject
Feedback: Report problem or ask question.
Links
MBS Xojo PDF Plugins