Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 17447

JSON Pickle serialize object list

$
0
0

I want to serialize a list of object using jsonpickle. Each of these objects contain a list of object within them:

class ImageManipulationConfiguration:    region_list = []    def to_json(self):        return jsonpickle.encode(self.region_list, indent=4, separators=(',', ': '))

here, region_list contains objects of this class:

class ImageManipulationRegion:    image_manipulation_element_list = []

Inside image_manipulation_element_list, there are objects of class inheriting this class :

class ImageManipulationElement

When I call my to_json function, only the top level items in the region_list are serialized, the sub oject within the image_manipulation_element_list lists are not included. Is there a way to recursively include everything using jsonpickle?


Viewing all articles
Browse latest Browse all 17447

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>