# Dictionary Key Order

**URL:** <https://forum.inductiveautomation.com/t/dictionary-key-order/63799>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [September 6, 2022, 8:19pm UTC](https://forum.inductiveautomation.com/t/dictionary-key-order/63799 "2022-09-06T20:19:13Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [September 6, 2022, 8:33pm UTC](https://forum.inductiveautomation.com/t/dictionary-key-order/63799/2 "2022-09-06T20:33:09Z")

</div>

You need `OrderedDict`.

[https://docs.python.org/2.7/library/collections.html#collections.OrderedDict](https://docs.python.org/2.7/library/collections.html#collections.OrderedDict)

> [@Ordered Dictionaries](https://forum.inductiveautomation.com/t/ordered-dictionaries/45949):
>
> Hi, I would like create a json file in a specific format, however there are some restriction involved. Declared dictionaries not in my specific key order (d,c,a,b). from collections import OrderedDict mylist = [] myOrderedDict = OrderedDict() myOrderedDict['d'] = 4 myOrderedDict['c'] = 3 myOrderedDict['a'] = 1 myOrderedDict['b'] = mylist myOrderedDict #Intended result dict(myOrderedDict) #dict changed my result myDict = {} myDict['d'] = 4 myDict['c'] = 3 myDict['a'] = 1 myDict['b'] = myl…

---

_[View the full topic](https://forum.inductiveautomation.com/t/dictionary-key-order/63799)._
