Skip to content

Return null for non-finite string number conversions - #379

Open
muneikh wants to merge 1 commit into
jmespath:developfrom
muneikh:fix-nonfinite-number-conversion
Open

muneikh wants to merge 1 commit into
jmespath:developfrom
muneikh:fix-nonfinite-number-conversion

Conversation

@muneikh

@muneikh muneikh commented Oct 11, 2026

Copy link
Copy Markdown

to_number() currently converts strings such as NaN, Infinity, and overflowing exponents into non-finite floats. They then survive numeric projections and cannot be emitted as valid JSON with a strict encoder.

Return null when a string-to-float conversion produces a non-finite result. Integer conversion, finite floats, and number inputs retain their current behavior. This follows the specification's JSON result contract and its implementation-specific floating-point range, and allows projections to filter these unsuccessful conversions as usual.

Eight string conversion cases and a projection fail before the fix. The full unit/compliance suite passes: 993 passed, 1 skipped, and 8 subtests passed. git diff --check also passes. No hosted CI result is claimed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant