Merge pull request #81 from yukixz/fix-one-line-array

Sort matches before replacment on post process
This commit is contained in:
Terminal 2020-04-17 15:40:24 -04:00 committed by GitHub
commit 7cf04726d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -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())]