Skip to content
Advertisement

How can I remove the upper array list from the list of dictionaries?

I’ve a list of dictionaries and want to get rid of the external list array. Take into consideration the array below,

JavaScript

My serializer looks like,

JavaScript

and the view definition is,

JavaScript

Advertisement

Answer

You can use the index of list to refer to the inner dictionary and omit the outer bracket.

JavaScript

The below is the output of a[0]:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement