Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
vidjil
vidjil
Commits
b0053cd2
Commit
b0053cd2
authored
Feb 24, 2015
by
Mathieu Giraud
Browse files
format_json.py: 2to3
parent
49764000
Changes
1
Show whitespace changes
Inline
Side-by-side
tools/format_json.py
View file @
b0053cd2
from
__future__
import
print_function
import
json
import
sys
from
collections
import
OrderedDict
...
...
@@ -12,8 +13,8 @@ parser.add_argument('file', nargs='?', type=argparse.FileType('r'), default=sys.
args
=
parser
.
parse_args
()
json_data
=
args
.
file
.
read
()
print
json
.
dumps
(
json
.
loads
(
json_data
,
object_pairs_hook
=
OrderedDict
),
print
(
json
.
dumps
(
json
.
loads
(
json_data
,
object_pairs_hook
=
OrderedDict
),
sort_keys
=
not
args
.
unsorted
,
indent
=
None
if
args
.
one_line
else
2
)
indent
=
None
if
args
.
one_line
else
2
)
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment