I actually got it worked out. Since the output always starts with a “results” field, i “strip” it away and pipe the list into the serializer. The trick is to use “many=true” and now the serializer works perfectly.
On Friday, 27 January 2017 20:26:57 UTC+8, Filipe Ximenes wrote: > > Hi Lim, can you provide some code showing what you are trying to do? > > On Wed, Jan 25, 2017 at 7:21 AM, Hock Leong Lim <[email protected] > <javascript:>> wrote: > >> Hi all, >> >> I’m new to DRF and I have some JSON data that is structured as below. The >> default JSON serializer don’t seem to understand this structure. How do i >> proceed to serialize the data below? Do i need to write a custom serializer? >> >> { "results": [ { "playerName": "Jang Min Chul", "updatedAt": >> "2011-08-19T02:24:17.787Z", "cheatMode": false, "createdAt": >> "2011-08-19T02:24:17.787Z", "objectId": "A22v5zRAgd", "score": 80075 }, >> { "playerName": "Sean Plott", "updatedAt": "2011-08-21T18:02:52.248Z", >> "cheatMode": false, "createdAt": "2011-08-20T02:06:57.931Z", "objectId": >> "Ed1nuqPvcm", "score": 73453 } ] } >> >> Regards, >> Lim >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django REST framework" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > *Filipe Ximenes* > Partner & Developer > Hangout: [email protected] <javascript:> > Skype: filipeaximenes > > > We design, develop and fix beautiful software. > > *http://www.vinta.com.br/ <http://www.vinta.com.br/>* > -- You received this message because you are subscribed to the Google Groups "Django REST framework" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
