Created
November 8, 2013 12:09
-
-
Save scottslowe/7370142 to your computer and use it in GitHub Desktop.
This output came from running the raw JSON-serialized response to a REST API through the python json.tool command.
This file contains hidden or 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
{ | |
"result_count": 3, | |
"results": [ | |
{ | |
"_href": "/ws.v1/lswitch/3ca2d5ef-6a0f-4392-9ec1-a6645234bc55", | |
"_schema": "/ws.v1/schema/LogicalSwitchConfig", | |
"type": "LogicalSwitchConfig" | |
}, | |
{ | |
"_href": "/ws.v1/lswitch/81f51868-2142-48a8-93ff-ef612249e025", | |
"_schema": "/ws.v1/schema/LogicalSwitchConfig", | |
"type": "LogicalSwitchConfig" | |
}, | |
{ | |
"_href": "/ws.v1/lswitch/9fed3467-dd74-421b-ab30-7bc9bfae6248", | |
"_schema": "/ws.v1/schema/LogicalSwitchConfig", | |
"type": "LogicalSwitchConfig" | |
} | |
] | |
} |
So helpful. Thank you!
This is excellent! Update the script if you're using zsh:
#!/bin/zsh
python -m json.tool
Now the path has changed, it's ~/Library/Containers/com.barebones.bbedit/Data/Library/Application Support/BBEdit/Text Filters/
As of BBEdit 14.0, rather than this custom filter, you can use BBEdit's own built-in module.
Added JSON formatting support to the factory-supplied JSON language module. Choose "Reformat Document" from the Text menu to reformat the document's text.
@martinburch Good to know, thanks!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Well just commenting here to say thanks, that works great. To repeat your blog post here which might help others:
Put the above in a file, perhaps,
jsonify.sh
Place jsonify.sh (or a link to this script) in the
~/Library/Application Support/BBEdit/Text Filters
directory, restart BBEdit.To use:
Select unformatted JSON, choose jsonify under Text>Apply Text Filters>jsonify . The text will be transformed to pretty printed JSON in place of the unformatted.