Handle NaN and Infinity, set them to Null, like JSON does
See original GitHub issue function append(data) {
data == null || data === NaN || data === Infinity ? appendByte(0xc0) :
(
data.constructor === String ? appendString :
data.constructor === Number ? appendNumber :
data.constructor === Boolean ? appendBoolean :
Array.isArray(data) ? appendArray :
data instanceof Date ? appendDate :
appendObject
)(data)
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
JSON left out Infinity and NaN; JSON status in ECMAScript?
Any idea why JSON left out NaN and +/- Infinity? It puts Javascript in the strange situation where objects that would otherwise be...
Read more >Handling of infinity and NaN #397 - boostorg/json - GitHub
NaN is serialized as such but then it actually throws as it's not recognized ... 1e800 is Infinity (-1e800) in JS, plus NaN...
Read more >json.dumps() should encode float number NaN to null
Float numbers in Python can have 3 special number: nan, inf, -inf, which are encoded by json module as "NaN", "Infinity", "-Infinity".
Read more >How to handle null, infinity, and not-a-number values
This guide will show you how to handle null, infinity, and not-a-number (NaN) values in your datasets. Not all numeric types support each...
Read more >JSON Files - Spark 3.3.1 Documentation
Property Name Default Scope
primitivesAsString false read
prefersDecimal false read
allowComments false read
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can you please specify what exactly needs to be converted to what in what function? I just tried to put
NaN
through the test code and gotnull
back which seems to be what you’re asking for.Hmm, that’s interesting I’ll just remove the checks then and let DataView figure it out as you say. Thanks.