Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JSON.CreateNumber
Creates a new JSON encoded number.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JSON | 2.7 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "JSON.CreateNumber"; value ) More
Parameters
Parameter | Description | Example |
---|---|---|
value | The number value. | 123.4 |
Result
Returns JSON code.
Description
Creates a new JSON encoded number.Version 10.0 or newer preserve formatting if you pass a text with a number containing digits with optionally one dot and one minus.
Returns NULL if you pass empty text.
Examples
Creates a number:
MBS( "JSON.CreateNumber"; 123 )
Example result: 123
Create big number:
MBS( "JSON.CreateNumber"; 12063660878882855000013426248015578834577 )
Pass through vs. number parsing:
MBS( "JSON.CreateNumber"; "123.5" ) & ¶ & MBS( "JSON.CreateNumber"; 123,5 )
// in German with comma as separator second one is parsed as double precision value.
Example result:
123.5
123.500000
See also
- JSON.AddItemToArray
- JSON.AddNumberToArray
- JSON.AddValueToArray
- JSON.AddValueToObject
- JSON.CreateNull
Release notes
- Version 12.0
- Fixed JSON functions to return NULL for numbers with no content, e.g. empty text. This affects JSON.CreateNumber, Dictionary.ToJSON, FM.SQL.JSONColumn, FM.SQL.JSONRecord and FM.SQL.JSONRecords functions.
- Version 10.0
- Changed JSON functions to pass through floating numbers as is without rounding, in JSON.CreateNumber, JSON.AddNumberToArray and others.
- Version 8.0
- Fixed JSON.CreateNumber to return 0 for empty string.
Example Databases
Blog Entries
- MBS FileMaker Plugin, version 11.6pr3
- FileMaker and JavaScript - the perfect combination
- MBS FileMaker Plugin, version 9.6pr1
- With JSON in excellent form
- MBS FileMaker Plugin, version 7.6pr1
FileMaker Magazin
This function is free to use.
Created 18th August 2014, last changed 7th December 2021