Hi, I just came across this error when loading large integers where the integer extracted using orjson does not match the original large integer. Interestingly, the issue does not occur when loading the json file using json.
Here's the sample json file that I'm reading at "file.json":
This is the python code that I ran to compare the output between orjson and json. To highlight the issue, it occurs in the last 4 digits of the device tag that does not match the values in the original json file.
from pathlib import Path
import json
import orjson
fp = Path('.') / "file.json"
ojson_data = orjson.loads(fp.read_text())
ojson_deviceTag = ojson_data.get('locations')[0].get('deviceTag')
print(ojson_deviceTag ) # -8.024144696862913e+19
json_data = json.loads(fp.read_text())
json_deviceTag = json_data.get('locations')[0].get('deviceTag')
print(json_deviceTag) # -80241446968629135069
# The issue is more obvious when casting to int
print(int(ojson_deviceTag)) # -80241446968629133312
Hi, I just came across this error when loading large integers where the integer extracted using
orjson
does not match the original large integer. Interestingly, the issue does not occur when loading the json file usingjson
.Here's the sample json file that I'm reading at "file.json":
This is the python code that I ran to compare the output between
orjson
andjson
. To highlight the issue, it occurs in the last 4 digits of the device tag that does not match the values in the original json file.