2 ms·
Well, pretty obviously, if your use case satisfies (most of) the following prerequisites, there is no reason to chose JSON over pickle: - you need to serialise
by BerislavLopac 8y ago
Well, pretty obviously, if your use case satisfies (most of) the following prerequisites, there is no reason to chose JSON over pickle:
- you need to serialise arbitrary objects
- you both read and write only using Python
- your transfer protocol handles binary data (as opposed to plain text)
- you don't need the serialisation to be human-readable
- you want to be able to handle any Python type
- you don't want to write your own serialization rules
JSON is "safer" only if you have full control over deserialization.