Tools, FAQ, Tutorials:
json.tool - JSON Pretty-Print Tool
What is json.tool? Can I use it to convert a JSON string a pretty-print format?
✍: FYIcenter.com
json.tool is a special internal executable module -
a module with main() so you can run it as Python script.
When you run json.tool, (or json.module.main()), it will read a JSON string from the stand input and write the stand output in pretty-print format.
You can use the json.tool module from the command line:
C:\fyicenter> type sample.json
["foo", {"bar":["baz", null, 1.0, 2]}]
C:\fyicenter> python -m json.tool < sample.json
[
"foo",
{
"bar": [
"baz",
null,
1.0,
2
]
}
]
You can also call the json.tool.main() from your Python script:
>>> import json.tool
>>> json.tool.main()
["foo", {"bar":["baz", null, 1.0, 2]}]
^Z
[
"foo",
{
"bar": [
"baz",
null,
1.0,
2
]
}
]
>>>
Note that you need to press Ctrl-Z to end the standard input stream.
⇒ 'urllib' Module - Internet Communication
⇐ json.loads() - Loading JSON into Object
2018-09-24, ∼3031🔥, 0💬
Popular Posts:
How To Protect Special Characters in Query String in PHP? If you want to include special characters ...
What is Azure API Management Developer Portal Admin? The Developer Portal Admin is an Azure Web port...
How to use 'choose ... when ..." policy statements to control execution flows? If you want to contro...
How to login to the Developer Portal internally by you as the publisher? Normally, the Developer Por...
How to install "The Windows SDK version 8.1"? I need to build my Visual Studio C++ applications. If ...