haskell / haskell/aeson

Feature request to (optionally) support "Python JSON" number extensions

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

Description

It would be really great if Aeson was able to parse (and re-serialize) JSON generated with the Python `json` module, which has some extra (non-spec) features with regard to numbers:

```python
import json
import math

print(
json.dumps(
{
"foo": 99,
"bar": math.nan,
"baz": -math.inf
}
)
)
```

which yields

```
{"foo": 99, "bar": NaN, "baz": -Infinity}
```

I think `NaN`, `Infinity` and `-Infinity` are the only extra tokens that occur.

For me personally this comes up when working with JSON generated by data-scientists, where Python is the main language and these values seem to occur often.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.