Current Path: > > lib64 > python2.7 > json
Operation : Linux premium107.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64 Software : Apache Server IP : 198.54.126.246 | Your IP: 216.73.216.181 Domains : 1034 Domain(s) Permission : [ 0755 ]
| Name | Type | Size | Last Modified | Actions |
|---|---|---|---|---|
| __init__.py | File | 14721 bytes | April 10 2024 04:58:35. | |
| __init__.pyc | File | 13926 bytes | April 10 2024 04:58:46. | |
| __init__.pyo | File | 13926 bytes | April 10 2024 04:58:46. | |
| decoder.py | File | 13698 bytes | April 10 2024 04:58:35. | |
| decoder.pyc | File | 11960 bytes | April 10 2024 04:58:46. | |
| decoder.pyo | File | 11960 bytes | April 10 2024 04:58:46. | |
| encoder.py | File | 16399 bytes | April 10 2024 04:58:35. | |
| encoder.pyc | File | 13721 bytes | April 10 2024 04:58:46. | |
| encoder.pyo | File | 13721 bytes | April 10 2024 04:58:46. | |
| scanner.py | File | 2297 bytes | April 10 2024 04:58:35. | |
| scanner.pyc | File | 2229 bytes | April 10 2024 04:58:46. | |
| scanner.pyo | File | 2229 bytes | April 10 2024 04:58:46. | |
| tool.py | File | 997 bytes | April 10 2024 04:58:35. | |
| tool.pyc | File | 1294 bytes | April 10 2024 04:58:46. | |
| tool.pyo | File | 1294 bytes | April 10 2024 04:58:46. |
r"""Command-line tool to validate and pretty-print JSON
Usage::
$ echo '{"json":"obj"}' | python -m json.tool
{
"json": "obj"
}
$ echo '{ 1.2:3.4}' | python -m json.tool
Expecting property name enclosed in double quotes: line 1 column 3 (char 2)
"""
import sys
import json
def main():
if len(sys.argv) == 1:
infile = sys.stdin
outfile = sys.stdout
elif len(sys.argv) == 2:
infile = open(sys.argv[1], 'rb')
outfile = sys.stdout
elif len(sys.argv) == 3:
infile = open(sys.argv[1], 'rb')
outfile = open(sys.argv[2], 'wb')
else:
raise SystemExit(sys.argv[0] + " [infile [outfile]]")
with infile:
try:
obj = json.load(infile)
except ValueError, e:
raise SystemExit(e)
with outfile:
json.dump(obj, outfile, sort_keys=True,
indent=4, separators=(',', ': '))
outfile.write('\n')
if __name__ == '__main__':
main()
SILENT KILLER Tool