title: Export array of objects each containing array of objects in a attribute in python
body: <p>My data structure is like this:</p>
  <pre><code>Contents = [];
  class Post:
    def __init__(self, poster,poster_url,post_text, post_images, post_comments):
      self.poster = poster
      self.poster_url = poster_url
      self.post_text = post_text
      self.post_images = post_images
      self.post_comments = post_comments    
  
  class Comment:
    def __init__(self, poster,poster_url,post_text, post_images):
      self.poster = poster
      self.poster_url = poster_url
      self.post_text = post_text
      self.post_images = post_images 
  </code></pre>
  <p>I am trying to store array of comment inside post class and post class inside array Contents.But I am not finding any way to export this.How should I export this to formats like csv,excel or json?</p>