https://github.com/virtuald/go-pyjson
golang JSON parser that supports NaN and Infinity in the same way that Python does
https://github.com/virtuald/go-pyjson
Last synced: about 1 month ago
JSON representation
golang JSON parser that supports NaN and Infinity in the same way that Python does
- Host: GitHub
- URL: https://github.com/virtuald/go-pyjson
- Owner: virtuald
- License: bsd-3-clause
- Created: 2021-04-06T06:09:42.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-04-06T06:09:57.000Z (about 5 years ago)
- Last Synced: 2025-01-26T11:09:00.450Z (over 1 year ago)
- Language: Go
- Size: 502 KB
- Stars: 0
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
go-pyjson
=========
A forked version of the golang standard library JSON parser that supports
NaN/Infinity as supported by the Python JSON implementation.
Why?
----
`NaN` and `Infinity` are not allowed by the JSON spec, but the Python JSON
implementation allows it. This is useful for interoperability with Python JSON
implementations when floating point data is being exchanged.
Here's what python does:
```pycon
>>> json.dumps([math.nan, math.inf, -math.inf])
'[NaN, Infinity, -Infinity]'
```
It seems likely that the golang project will not support adding this option
to the standard library implementation.
* https://github.com/golang/go/issues/3480
* https://github.com/golang/go/issues/25721
License
-------
This is just a modification of the standard library's JSON parser, so it is
provided under the same BSD-style license.