Based on the DRF documentation, I created an email_id list stored in my model as follows Models.py
class UserData(models.Model): emails = models.CharField(max_length=100,blank=False)
In my serializers.py file
class UserSerializer(serializers.ModelSerializer): emails = serializers.ListField(child = serializers.EmailField())
When sending data, the drf page displays data in the expected format, i.e.
"emails": [ " bal@bal.com " ],
But, if I request the same data using python or any rest client. I get the data in the following format
data = json.load(urllib2.urlopen("http://localhost:8000/blah/id")) In [46]: d['emails'] Out[46]: [u'[', u'u', u"'", u'b', u'a', u'l', u'@', u'b', u'a', u'l', u'.', u'c', u'o', u'm', u"'", u']']
Ideally, it should have been
d['emails'] = [' bal@bal.com ']
I'm not sure what is wrong here. Any suggestions?