panini
panini copied to clipboard
ValueError: Expected object or value - ujson does not support NaN
panini uses ujson.loads for bytes loading, but it does not support NaN, when common json module supports it:
# This code will work:
json.loads(b'{"success":true,"data":[{"open":NaN,"high":NaN,"low":NaN,"close":NaN,"volume":0.0,"timestamp":1626427980000},{"open":NaN,"high":NaN,"low":NaN,"close":NaN,"volume":0.0,"timestamp":1626428040000}]}')
# When this will throw an error - ValueError: Expected object or value:
ujson.loads(b'{"success":true,"data":[{"open":NaN,"high":NaN,"low":NaN,"close":NaN,"volume":0.0,"timestamp":1626427980000},{"open":NaN,"high":NaN,"low":NaN,"close":NaN,"volume":0.0,"timestamp":1626428040000}]}')