Created
September 7, 2023 00:32
-
-
Save mkasberg/148c1ba10a0864f59f414d296961fb9b to your computer and use it in GitHub Desktop.
Boilerplate to parse JSON in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import json | |
if len(sys.argv) < 2: | |
print("Usage: parse_json.py FILENAME.json") | |
exit(1) | |
filename = sys.argv[1] | |
file = open(filename) | |
data = json.load(file) | |
file.close() | |
print(json.dumps(data, indent=2)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment