Is there a way to make the JSON output of curl
commands Pretty printed by default? That is, without specifying the option of ?pretty=true
to the curl URL, is it possible to display the output pretty printed everytime?
SSSZ or yyyy-MM-dd .
We use HTTP requests to talk to ElasticSearch. A HTTP request is made up of several components such as the URL to make the request to, HTTP verbs (GET, POST etc) and headers. In order to succinctly and consistently describe HTTP requests the ElasticSearch documentation uses cURL command line syntax.
Advanced Settingsedit. Advanced Settings control the behavior of Kibana. For example, you can change the format used to display dates, specify the default data view, and set the precision for displayed decimal values. Open the main menu, then click Stack Management > Advanced Settings.
I was able to accomplish this by adding a new alias to my .bashrc (or .bash_profile on a mac):
alias pp='python -mjson.tool'
Then, after reloading the .bashrc / .bash_profile configuration by opening a new terminal or by running
$ source ~/.bashrc
you can pipe curl output to the 'pp' alias as follows:
$ curl -XGET http://localhost:9200/_search | pp
Source: http://ruslanspivak.com/2010/10/12/pretty-print-json-from-the-command-line/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With