Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit 07846306 authored by Mikaël Salson's avatar Mikaël Salson
Browse files

format_json.py: Put all the JSON on a single line.

If the JSON is not valid, raises an exception

format-json.sh is deleted because format_json.py has
similar features while checking syntax additionnally.
parent f7bdde36
#!/bin/sh
tr "\n" " " | sed "s/}/}\n/g"
import json
import sys
from collections import OrderedDict
f = sys.stdin
if len(sys.argv) > 1:
f = open(sys.argv[1])
s = f.read()
print json.dumps(OrderedDict(json.loads(s, object_pairs_hook=OrderedDict))).replace('\n', ' ')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment