Skip to content
Permalink
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/rcColor.py
@@ -9,6 +9,11 @@
from jsonpath_ng import jsonpath
from jsonpath_ng.ext import parse

try:
from collections import OrderedDict
except ImportError:
OrderedDict = dict

if os.name == "nt":
import colorama
colorama.init()
@@ -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.