Fix compacting large json files
This commit is contained in:
parent
119e1a9bf0
commit
917a2e59ce
1 changed files with 2 additions and 2 deletions
|
@ -49,7 +49,7 @@ def jsonDumps(data):
|
|||
else:
|
||||
return match.group(0)
|
||||
|
||||
content = re.sub(r"\{(\n[^,\[\{]{10,100}?)\}[, ]{0,2}\n", compact_dict, content, flags=re.DOTALL)
|
||||
content = re.sub(r"\{(\n[^,\[\{]{10,100000}?)\}[, ]{0,2}\n", compact_dict, content, flags=re.DOTALL)
|
||||
|
||||
def compact_list(match):
|
||||
if "\n" in match.group(0):
|
||||
|
@ -58,7 +58,7 @@ def jsonDumps(data):
|
|||
else:
|
||||
return match.group(0)
|
||||
|
||||
content = re.sub(r"\[([^\[\{]{2,300}?)\][, ]{0,2}\n", compact_list, content, flags=re.DOTALL)
|
||||
content = re.sub(r"\[([^\[\{]{2,100000}?)\][, ]{0,2}\n", compact_list, content, flags=re.DOTALL)
|
||||
|
||||
# Remove end of line whitespace
|
||||
content = re.sub(r"(?m)[ ]+$", "", content)
|
||||
|
|
Loading…
Reference in a new issue