jless icon indicating copy to clipboard operation
jless copied to clipboard

Parse error with NaN, Infinity, -Infinity

Open daniel-wells opened this issue 3 years ago • 0 comments

By default Python's json module allows NaN and Infinity when serialising to json:

>>> import json
>>> json.dumps({'a':float('nan'), 'b':float('inf')})
'{"a": NaN, "b": Infinity}'

Though technically this isn't complient JSON, it would be nice if jless was more permissive to allow the viewing of these files?:

>>> echo '{"x": NaN}' | jless
Unable to parse input: "Parse error"

daniel-wells avatar Feb 25 '22 15:02 daniel-wells