title: How to return a single object with Django-Rest-Framework
body: <p>I'm trying to return a single object with profile information but am stuck getting an array in return. How do I just return a single object.</p>
  
  <p>Current output:</p>
  
  <pre><code>[{"id":1,"username":"someusername"}]
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>{"id":1,"username":"someusername"}
  </code></pre>
  
  <p>serializers.py</p>
  
  <pre><code>from rest_framework import serializers
  from django.contrib.auth.models import User
  
  
  class UserSerializer(serializers.ModelSerializer):
      class Meta:
          model = User
          fields = ('id', 'username')
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code># from django.shortcuts import render
  from django.contrib.auth.models import User
  from profiles.serializers import UserSerializer
  from rest_framework import viewsets
  # Create your views here.
  
  
  class CurrentUserViewSet(viewsets.ReadOnlyModelViewSet):
      """
      Lists information related to the current user.
      """
      serializer_class = UserSerializer
  
      def get_queryset(self):
          user = self.request.user.id
          return User.objects.filter(id=user)
  </code></pre>