v.23.1Improvement

Allow Implicit Conversion of Floats in JSONExtract Functions

Allow to implicitly convert floats stored in string fields of JSON to integers in JSONExtract functions. E.g. JSONExtract('{"a": "1000.111"}', 'a', 'UInt64') -> 1000, previously it returned 0. #45432 (Anton Popov).
Allow implicit conversion of float values stored as strings in JSON fields to integers using JSONExtract functions.

Why it matters

Previously, attempting to extract an integer from a JSON string field containing a float (e.g., "1000.111") using JSONExtract would return 0. This feature enables correct extraction by implicitly converting float-formatted strings to integers, improving data extraction accuracy and usability.

How to use it

Use the JSONExtract function as usual to extract integer types from JSON fields containing float values stored as strings. For example: JSONExtract('{"a": "1000.111"}', 'a', 'UInt64') will now return 1000 instead of 0.