code: def to_dict(self):
          
          return {
              'level': self.level,
              'id': self.id,
              'text': self.text,
              'inner_html': self.inner_html,
              'children': [child.to_dict() for child in self.children]
          }
docs: Convert self to a dict object for serialization.