haskell / haskell/aeson

Support roundtripping of numbers

Open
#840 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
1.3k
Forks
336
Avg merge
3d 7h
Merged PRs (30d)
4

Description

Slightly related to #679

There are edge cases with Number where we don't roundtrip, e.g.
```
λ encode (decode "3.00e-3" :: Maybe Value)
"3.0e-3"
```
We've also had to add restrictions on parsing Scientific to prevent security issues.

I'm wondering if we should change Number to a type that essentially just stores the original text representation. This way we can properly roundtrip all numeric values, and we can disallow NaN/Infinity per the spec.

Contributor guide

Open the contributing guide

Research direction

Start by examining the Number representation and the Scientific parsing restrictions described in the issue, using the 3.00e-3 example as a reproduction. Determine the intended design before changing anything; done should include correct numeric roundtripping and rejection of NaN and Infinity according to the JSON specification.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
backend
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.