Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
Adds a number to an array.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 4.3 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
json | A JSON text or reference. | [1,2,3] |
Value... | The number to be added | 5 |
Returns JSON code or error.
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 )
This function checks for a license.
Created 26th August 2014, last changed 5th June 2021