title: Django Rest Framework create multiple objects
body: <p>This is what I have so far.</p>
  
  <p>My serializer:</p>
  
  <pre><code>class MySerializer(serializers.ModelSerializer):
  
       class Meta:
           model = MyModel
           fields = ('field_1', 'field_2', 'field_3')
  </code></pre>
  
  <p>My ModelViewset</p>
  
  <pre><code>class MyViewSet(ModelViewSet):
  
      serializer_class = MySerializer
      model = MyModel
      queryset = MyModel.objects.all().order_by('date_paid')
  
      def create(self, request, *args, **kwargs):
          many = True if isinstance(request.data, list) else False
          serializer = MySerializer(data=request.data, many=many)
          if serializer.is_valid():
              serializer.save()
          else:
              return Response(serializer.errors, 
  status=status.HTTP_400_BAD_REQUEST)
          return Response(serializer.data, status=status.HTTP_201_CREATED)
  </code></pre>
  
  <p>My main concern is that when testing the endpoint to create multiple objects using the following payload, on the view the property <code>request.data</code> seem to be empty, as a result it returns errors of fields missing.</p>
  
  <pre><code>{
          'data': [
              {
                  'type': 'MySerializer',
                  'attributes': {
                      'field_1': 1,
                      'field_2': 0.05,
                      'field_3': 'abc'
                  }
              },
              {
                  'type': 'MySerializer',
                  'attributes': {
                      'field_1': 1,
                      'field_2': 0.05,
                      'field_3': 'abc'
                  }
              },
              {
                  'type': 'MySerializer',
                  'attributes': {
                      'field_1': 1,
                      'field_2': 0.05,
                      'field_3': 'abc'
                  }
              }
          ]
      }
  </code></pre>
  
  <p>However when using a single object instance:</p>
  
  <pre><code>{
          'data': {
              'type': 'MySerializer',
              'attributes': {
                      'field_1': 1,
                      'field_2': 0.05,
                      'field_3': 'abc'
              }
          }
      }
  </code></pre>
  
  <p>It seeems to work just fine and the object is created.</p>
  
  <p>I have tried several ways to accomodate the payload:</p>
  
  <ul>
  <li>Placing the list of objects inside the <code>attributes</code> field.</li>
  <li>Placing the list of instances directly on the <code>data</code> field but it returns either an object error, or and empty <code>request.data</code></li>
  </ul>
  
  <p>How am I supposed to send the data for multiple objects, is it even possible, I have read in many articles that just by placing <code>many=True</code> on the serializer instance is enough to accomplish this but I just cant't get the data from the request.</p>
  
  <p>Any step that I missed or another workaround? </p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Forgot to mention two things </p>
  
  <ol>
  <li>that I'm using <a href="https://django-rest-framework-json-api.readthedocs.io/en/stable/index.html" rel="nofollow noreferrer">django rest framework json api</a> library, could that be the reason why the data is empty?</li>
  <li>I placed dictionaries since I'm testing the endpoints and I use json.dumps(payload) when sending data.</li>
  </ol>