« Copy Script Button wi… | Home | Sum up values in JSON… »

JSON with large integers

Did you know that MBS Plugin can handle JSON with large integers?

In native FileMaker the call

JSONSetElement( ""; "key"; 12063660878882855000013426248015578834577; JSONNumber)

returns {"key":1.20636608788829e+40} as result. So in-between, the number is converted to double data type, which only has a precision of 15 digits.

With curent MBS Plugin, you would add a number directly like this:

MBS( "JSON.AddItemToObject"; "{}"; "test"; "12063660878882855000013426248015578834577" )

and get back

  "test": 12063660878882855000013426248015578834577

So MBS Plugin got the feature to pass through large numbers and avoid conversions to double.
This is a nice advantage and allows our plugin to parse a big JSON and preserve numbers. e.g.

MBS( "JSON.Compact"; MBS( "JSON.Parse"; "{ \"test\": 12063660878882855000013426248015578834577}"; "test" ))

returns {"test":12063660878882855000013426248015578834577} back and the big number is not affected.

For next release (8.2) we also updated JSON.AddNumberToArray and JSON.AddNumberToObject to use the newer code to pass through big numbers.
11 05 18 - 08:36