# Ordering/grouping of list of dicts

**URL:** <https://forum.djangoproject.com/t/ordering-grouping-of-list-of-dicts/15976>\
**Category:** Forms & APIs\
**Created:** [September 15, 2022, 1:35am UTC](https://forum.djangoproject.com/t/ordering-grouping-of-list-of-dicts/15976 "2022-09-15T01:35:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bkbirr](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/bkbirr/32/618_2.png) [@bkbirr](https://forum.djangoproject.com/u/bkbirr)\
**Post date:** [September 15, 2022, 1:35am UTC](https://forum.djangoproject.com/t/ordering-grouping-of-list-of-dicts/15976/1 "2022-09-15T01:35:30Z")

</div>

I am getting a json response back from an API call and converting to python list via `json.loads()`. I am using Django’s `{% regroup %}` to regroup and display by company, but the `company_list` is ordered alphabetically. I would like to have the results grouped by company but the companies ordered by lowest price. Can anyone point me in the right direction? Thanks

results\_list = [{“company”: “Adidas”, “price”: 100.0, }, {“company”: “Adidas”, “price”: 110.0, }, {“company”: “Brooks”, “price”: 80.0, }, {“company”: “Brooks”, “price”: 120.0, }, {“company”: “Nike”, “price”: 150.0, }, {“company”: “Nike”, “price”: 180.0, },]

desired\_list = [{“company”: “Brooks”, “price”: 80.0, }, {“company”: “Brooks”, “price”: 120.0, }, {“company”: “Adidas”, “price”: 100.0, }, {“company”: “Adidas”, “price”: 110.0, }, {“company”: “Nike”, “price”: 150.0, }, {“company”: “Nike”, “price”: 180.0, },]

I am using this in the template to display the prices for each company.

```auto
{% regroup results_list by company as company_list %}
{% for company in company_list %}
     {% include 'company_card.html' %}
{% endfor %}

```

---

<div class="post-metadata">

**Author:** ![leandrodesouzadev](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/leandrodesouzadev/32/8981_2.png) [@leandrodesouzadev](https://forum.djangoproject.com/u/leandrodesouzadev)\
**Post date:** [September 15, 2022, 11:22am UTC](https://forum.djangoproject.com/t/ordering-grouping-of-list-of-dicts/15976/2 "2022-09-15T11:22:35Z")

</div>

Hey there!  
Maybe [`dictsort` filter](https://docs.djangoproject.com/en/4.1/ref/templates/builtins/#dictsort) solves it for you.
