deserializeJSON() converts large decimals to string

Description

Importing a JSON document with large decimal numbers causes those decimal numbers to be converted to a string.

This makes it difficult to generate WKT polygons from JSON, for example, without manually converting the latitudes and longitudes back to a numeric value.

Here's an example:

https://trycf.com/scratch-pad/gist/29c3cceff42e80a843c33100d4193ed3

Environment

None

Attachments

1

Activity

Show:

Pothys - MitrahSoft 2 December 2021 at 10:40

I've checked this ticket in both fixed versions. The large decimal values on deserializeJSON() don't convert to string and instead, it was rounded as ACF does.
deserializeJSON() and serializeJSON() the precision were maintained

  • In lucee 6 - up to 24 decimal digits

  • lucee 5.3 - up to 12 decimal digits

  • ACF - up to 15 decimal digits

Michael Offner 1 December 2021 at 17:43

please give this some testing, see new test cases…

Michael Offner 1 December 2021 at 17:42

Fixed in 6.0 in a more progressive way, if the double string format loses information it is transformed to BigDecimal

Michael Offner 1 December 2021 at 17:36

Fixed in 5.3 in a more conservative way to be as much backward compatible as possible. So we keep it as double as long as possible and only make it a BigDecimal if really necessary.

Michael Born @ Ortus 13 September 2021 at 14:28

The expected result is that the lat and lon values are a numerical type - not a string. This ticket is not about rounding but about deserializeJSON() autocasting large floats to strings.

The TryCF test case does demonstrate the issue - see the quotation marks?

Fixed

Details

Assignee

Reporter

Priority

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Created 9 August 2021 at 18:28
Updated 16 June 2024 at 19:29
Resolved 2 December 2021 at 10:40