[Solved] How to change object structure into array structure for highcharts


If you want to convert your list of dictionaries to a list of lists on the server side you can do it like so:

>>> data = [{'tahun': '2010', 'apel': 100, 'pisang': 200, 'anggur': 300, 'nanas': 400, 'melon': 500}, {'tahun': '2011', 'apel': 145, 'pisang': 167, 'anggur': 210, 'nanas': 110, 'melon': 78}]
>>> [[x['tahun'], x['apel']] for x in data]
[['2010', 100], ['2011', 145]]

solved How to change object structure into array structure for highcharts