Merge pull request #156 from dzhibas/fix/array/comma

fix array comma
This commit is contained in:
Terminal 2021-07-30 22:57:54 -07:00 committed by GitHub
commit 02465c175e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -89,15 +89,15 @@ class PrettyJsonBaseCommand:
items = [item[:-1] if item[-1] == "," else item for item in items]
replacement = "["
for index, item in enumerate(items):
if item in ('{', '}'):
if item in ('{', '}') or item.endswith("{") or item.startswith("}"):
replacement = replacement + item
if item == '}':
if index!= len(items)-1:
if index != len(items)-1 and items[index+1] != "}":
replacement = replacement + ','
else:
replacement = replacement + item
if index != len(items)-1:
if items[items.index(item)+1] != '}':
if items[index+1] != '}':
replacement = replacement + ','
replacement = replacement + ']'