Skip to content
Browse files

Avoid sorting json output for ordered dict

a json dumps is used to inject an encap config. Avoiding the sort preserves
the section order, and thus avoids fetching back from encap.
  • Loading branch information...
cvaroqui committed Jul 22, 2019
1 parent f56a2e6 commit 00a548a0e8f6c4586b3f915b0335b8e1e888107d
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/
@@ -9,6 +9,11 @@
from jsonpath_ng import jsonpath
from jsonpath_ng.ext import parse

from collections import OrderedDict
except ImportError:
OrderedDict = dict

if == "nt":
import colorama
@@ -115,8 +120,10 @@ def colorize_json(s):
def format_json(d):
import json

sort_keys = not isinstance(d, OrderedDict) and OrderedDict != dict

kwargs = {
"sort_keys": True,
"sort_keys": sort_keys,
"ensure_ascii": False,
"indent": 4,
"separators": (',', ': '),

0 comments on commit 00a548a

Please sign in to comment.
You can’t perform that action at this time.