From 6e769bd62cb431624f18ac970418360d6b478426 Mon Sep 17 00:00:00 2001 From: Dazzy Ding Date: Sat, 18 Feb 2017 19:41:53 +0800 Subject: [PATCH] Sort matches before replacment on post process --- PrettyJson.py | 1 + 1 file changed, 1 insertion(+) diff --git a/PrettyJson.py b/PrettyJson.py index a3432c9..7967628 100644 --- a/PrettyJson.py +++ b/PrettyJson.py @@ -90,6 +90,7 @@ class PrettyJsonBaseCommand: if post_process: # find all array matches matches = re.findall(r"\[([^\[\]]+?)\]", output_json) + matches.sort(key=len, reverse=True) join_separator = line_separator.ljust(2) for m in matches: items = [a.strip() for a in m.split(line_separator.strip())]