- #1
fog37
- 1,569
- 108
- TL;DR Summary
- Difference between Ppickle and json with Python
Hello,
I understand that pickle and json are two different modules to serialize Python data. Serialization means to convert an object into a string.
When using pickle, we convert the Python data into a binary file. With json, the data is converted into a json file which is essentially a text-file, like a huge string. Is that correct?
The json module can only serialize certain types ( int, str, dict, list) while pickle is more flexible and can serialize other objects. What kind of other objects would we pickle? Would anyone have an example?
In regards to pickle, a binary file always seems a better option as far as storage space even if it is not human readable. But I read that, with the pickle module, once the object is serialized, it is not possible to deserialize it using another language. Why not?
Thanks!
I understand that pickle and json are two different modules to serialize Python data. Serialization means to convert an object into a string.
When using pickle, we convert the Python data into a binary file. With json, the data is converted into a json file which is essentially a text-file, like a huge string. Is that correct?
The json module can only serialize certain types ( int, str, dict, list) while pickle is more flexible and can serialize other objects. What kind of other objects would we pickle? Would anyone have an example?
In regards to pickle, a binary file always seems a better option as far as storage space even if it is not human readable. But I read that, with the pickle module, once the object is serialized, it is not possible to deserialize it using another language. Why not?
Thanks!