Skip to content

Serobj is a library for serializing and de-serializing program objects.

License

Notifications You must be signed in to change notification settings

serobj/serobj-python

Repository files navigation

Serobj

License

Serobj is a library for serializing and de-serializing program objects.

Getting started

Run pip install serobj to install the latest stable version from PyPI.

Example:

import json
import serobj

def print_fn(self, *args):
    print(*args)

class A:
    print_fn = print_fn
   
    def __init__(self):
        self.some_attr = 1, 2, 3


# -------------- dump --------------

obj = A()
data = serobj.dumps(obj)

with open("A.json", "w") as f:
    json.dump(data, f, indent=4)


# -------------- load --------------

with open("A.json", "r") as f:
    data = json.load(f)
    
obj = serobj.loads(data)
obj.print_fn(*obj.some_attr) # 1 2 3

Releases

No releases published

Packages

No packages published

Languages