title: Serialize SQLAlchemy Objects that have children with multiple children
body: <p>I have an SLQALchemy object that I am serializing with <a href="https://marshmallow.readthedocs.org/en/latest/index.html" rel="nofollow">marshmallow</a>. </p>
  
  <p>The object has N likes and N comments. It looks like this:</p>
  
  <pre><code>class Parent():
  
      __tablename__ = 'parent'
  
      title = Column(db.String(100), unique=True, nullable=False)
      description = Column(db.String(500))
      created_at = Column(db.DateTime, nullable=False, default=dt.datetime.utcnow)
      comments = relationship('Comment')
      likes = relationship('Like')
  </code></pre>
  
  <p>The serializers look like this:</p>
  
  <pre><code>class CommentSerializer(Serializer):
      class Meta:
          fields = ('id', 'text', 'created_at', 'parent_id')
  
  class LikeSerializer(Serializer):
      class Meta:
          fields = ('id', 'created_at', 'parent_id')
  
  class ParentSerializer(Serializer):
      comments = fields.Nested(CommentSerializer)
      likes = fields.Nested(LikeSerializer)
  
      class Meta:
          fields = ('id', 'title', 'description', 'comments', 'likes')
  </code></pre>
  
  <p>I try to run this in the view like so:</p>
  
  <pre><code>allParents = Parent.query.all()
  </code></pre>
  
  <p>And turn it into JSON with this:</p>
  
  <pre><code>return jsonify({"parents": ParentSerializer(allParents, many=True).data})
  </code></pre>
  
  <p>When I try and run that, I get an error <code>list indices must be integers, not str</code>. It comes from <code>marshmallow/serializer.py</code>. When I log some things in there, it appears that marshmallow is trying to access the <code>text</code> property of a list of <code>&lt;Comment&gt;</code>. It should be accessing each <code>&lt;Comment&gt;</code> individually then accessing the <code>text</code> property.</p>
  
  <p>Am I missing something in my serializer(s)? I know sending the <code>many=True</code> argument in ParentSerializer tells marshmallow that it should iterate through a list of <code>&lt;Parent&gt;</code>. Is there a way to tell marshmallow that it should also expect many <code>&lt;Comment&gt;</code> or <code>&lt;Like&gt;</code>?</p>