Skip to main content Brad's PyNotes

Posts on Serialization

  1. Pickle Module

    TL;DR

    The pickle module serializes Python objects to bytes and deserializes them back - enabling object persistence and inter-process communication.

    Interesting!

    Pickle can serialize almost any Python object, including functions, classes, and nested objects - but never unpickle untrusted data as it can execute arbitrary code!

  2. JSON Module: Data Interchange Made Simple

    TL;DR

    The json module provides simple methods for converting between Python objects and JSON strings using loads() to parse JSON and dumps() to create JSON, essential for web APIs and data storage.