About Field Order in JSON Structures
If you want to preserve the field order in the JSON string that you are building in Python before 3.6, use OrderedDict
instead of dict
to build up the dictionary:
1 2 3 4 5 6 7 8 9 |
|
Since Python 3.6, the order of the keys and values is preserved for standard dictionaries.
Also by me
Django Paddle Subscriptions app
For Django-based SaaS projects.
Django App for You
Django GDPR Cookie Consent app
For Django websites that use cookies.
Django App for You