If the built-in json is jsut calling decode() under the hood then I can jsut do the same explicitly in my code with ujson and that's fine. But I thought it would be nice if ujson would let me skip that step for large JSON objects that happen to be stored as bytearrays because even decoding (and the string garbage) isn't free when the objects are really big and you have hundreds of thousands of them.
What did you do?
Try to pase a bytearray with ujson.
ujson.loads(bytearray(b'123'))
What did you expect to happen?
Expected same behavior as built-in json module:
>>> json.loads(bytearray(b'123'))
123
What actually happened?
>>> ujson.loads(bytearray(b'123'))
Traceback (most recent call last):
File "/opt/miniconda3/envs/OptimizedPreprocessing/lib/python3.8/code.py", line 90, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
TypeError: Expected String or Unicode
What versions are you using?
- OS: OS X
- Python: 3.8
- UltraJSON: 5.5.0
Please include code that reproduces the issue.
See above.
If the built-in
jsonis jsut callingdecode()under the hood then I can jsut do the same explicitly in my code withujsonand that's fine. But I thought it would be nice ifujsonwould let me skip that step for large JSON objects that happen to be stored asbytearrays because even decoding (and the string garbage) isn't free when the objects are really big and you have hundreds of thousands of them.What did you do?
Try to pase a
bytearraywithujson.What did you expect to happen?
Expected same behavior as built-in
jsonmodule:What actually happened?
What versions are you using?
Please include code that reproduces the issue.
See above.