add links to readme, add helper scripts
This commit is contained in:
23
scripts/minify-json.py
Normal file
23
scripts/minify-json.py
Normal file
@@ -0,0 +1,23 @@
|
||||
import json
|
||||
import sys
|
||||
|
||||
def minify_json(input_file, output_file):
|
||||
try:
|
||||
# Read JSON data from input file
|
||||
with open(input_file, 'r', encoding='utf-8') as f:
|
||||
data = json.load(f)
|
||||
|
||||
# Minify JSON and write to output file
|
||||
with open(output_file, 'w', encoding='utf-8') as f:
|
||||
json.dump(data, f, separators=(',', ':'), ensure_ascii=False)
|
||||
|
||||
print(f"Minified JSON saved to {output_file}")
|
||||
except Exception as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: python minify_json.py input.json output.json")
|
||||
else:
|
||||
minify_json(sys.argv[1], sys.argv[2])
|
||||
|
||||
Reference in New Issue
Block a user