> JSON supports floats, ints, (Unicode) strings, lists and dicts (with string
> keys). It doesn't support bytestrings (raw bytes).
Thanks, MRAB and Irmen. It looks like bson does what I need.
Skip
--
https://mail.python.org/mailman/listinfo/python-list
On 2017-07-21 19:52, Skip Montanaro wrote:
I would like to JSON encode some PDF and Excel files. I can read the content:
pdf = open("somefile.pdf", "rb").read()
but now what? json.dumps() insists on treating it as a string to be
interpreted as utf-8, and bytes == str in Python 2.x. I can't
jso
On 21/07/2017 20:52, Skip Montanaro wrote:
> I would like to JSON encode some PDF and Excel files. I can read the content:
>
> pdf = open("somefile.pdf", "rb").read()
>
> but now what? json.dumps() insists on treating it as a string to be
> interpreted as utf-8, and bytes == str in Python 2.x. I
I would like to JSON encode some PDF and Excel files. I can read the content:
pdf = open("somefile.pdf", "rb").read()
but now what? json.dumps() insists on treating it as a string to be
interpreted as utf-8, and bytes == str in Python 2.x. I can't
json.dumps() a bytearray. I can pickle the raw c