Python JSON Sort


Sort the Result

The json.dumps() method has parameters to order the keys in the result:

Example

Use the sort_keys parameter to specify if the result should be sorted or not:

json.dumps(x, indent=4, sort_keys=True)
Try it Yourself »


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.