Metadata-Version: 2.1
Name: Objackson
Version: 1.0.0
Summary: A JSON serializer for Python
Home-page: https://github.com/sv-giampa/Objackson
Author: 'Salvatore Giampà'
License: Apache License version 2.0
Keywords: json,serializer,deserializer,serialization,deserialization,object
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: File Formats :: JSON
Requires-Python: >=3.8.0
Description-Content-Type: markdown,
License-File: LICENSE

# Objackson
This is a JSON serializer for Python that supports deep serialization of objects and full reconstruction of object structure on deserialization.

At the moment it does not support circular references.

# How to use

    from objackson import obj2json, json2obj

    class MyClass:

        def __init__(self, x=0, y=0):
            self.__x = x
            self.__y = y
        
        @property
        def x(self):
            return self.__x

        @property
        def y(self):
            return self.__y

        def __eq__(self, obj)
            return self.x == obj.x and self.y = obj.y
        
    def main():
        obj1 = TestClass(2, 3)
        json = obj2json(obj1)
        obj2 = json2obj(json)

        # obj2 is a copy of obj1. Test it:
        if obj1 == obj2:
            print("SUCCESS")
        else:
            print("FAIL")

    if __name__ == "__main__"
        main()


For a class to be serializable, it must have a constructor that allows 0-arguments initialization.
