title: Post complex objects with Flask-marshmallow and flask-restful
body: <p>I'm developing an API to learn Flask using flask-restful and flask-marshmallow and I would like to know if it's possible to post and serialize a list of complex objects at once.</p>
  <p>Here's my current code:</p>
  <pre><code>class Post(db.Document):
      created_at = db.DateTimeField(default=datetime.now, required=True)
      title = db.StringField(max_length=255, required=True)
      slug = db.StringField(max_length=255, required=True)
      body = db.StringField(required=True)
      comments = db.ListField(db.EmbeddedDocumentField('Comment'))
  
      meta = {
          'allow_inheritance': True,
          'indexes': ['-created_at', 'slug'],
          'ordering': ['-created_at']
      }
  
  
  class Comment(db.EmbeddedDocument):
      created_at = db.DateTimeField(default=datetime.now, required=True)
      body = db.StringField(verbose_name=&quot;Comment&quot;, required=True)
      author = db.StringField(verbose_name=&quot;Name&quot;, max_length=255, required=True)
  
  
  class PostSerializer(Serializer):
      id = fields.String()
      class Meta:
          additional = (&quot;created_at&quot;, &quot;title&quot;, &quot;slug&quot;, &quot;body&quot;, &quot;comments&quot;)
  
  
  # just a test for multiple data
  class PostViewList(Resource):
      def __init__(self):
          self.reqparse = reqparse.RequestParser()
          self.reqparse.add_argument('posts', type = str, action='append',
                                     required = True, help = 'No posts given',
                                     location='json')
  
      def post(self):
          args = self.reqparse.parse_args()
  
          serializer = PostSerializer(many=True)
          result = serializer.load(args['posts'])
  
          return args[&quot;posts&quot;], 201
  
  api.add_resource(PostViewList, '/posts')
  </code></pre>
  <p>The way it is right now, I receive an error on &quot;serializer.load&quot; because the post is not treated as an object, but as a string. If i dont try to serialize and return the &quot;args['posts']&quot; it show me the whole string I've posted.</p>
  <p>I tried post the following Json:</p>
  <pre><code>{&quot;posts&quot;:[ { &quot;title&quot;:&quot;asd&quot;, &quot;slug&quot;: &quot;asd&quot;, &quot;body&quot; : &quot;asd&quot; }, { &quot;title&quot;:&quot;qwe&quot;, &quot;slug&quot;: &quot;qwe&quot;, &quot;body&quot; : &quot;qwe&quot; }]}
  </code></pre>
  <p>The way it is right now, I haven't sent yet a list of comments, because I can't even process just the process that I didn't tried.</p>