Skip to content

Instantly share code, notes, and snippets.

@Integralist
Created October 2, 2020 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Integralist/d6e750eb89d4a3e97bed37b80abe6e4d to your computer and use it in GitHub Desktop.
Save Integralist/d6e750eb89d4a3e97bed37b80abe6e4d to your computer and use it in GitHub Desktop.
[Curl to JSON] #curl #bash #shell #json
# https://daniel.haxx.se/blog/2020/03/17/curl-write-out-json/
#
curl --write-out '%{json}' https://example.com -svo /dev/null | jq
{
"url_effective": "https://example.com/",
"method": "GET",
"http_code": 200,
"response_code": 200,
"http_connect": 0,
"time_total": 0.365787,
"time_namelookup": 0.001746,
"time_connect": 0.002049,
"time_appconnect": 0.27916,
"time_pretransfer": 0.279358,
"time_starttransfer": 0.365528,
"size_header": 351,
"size_request": 75,
"size_download": 1256,
"size_upload": 0,
"speed_download": 3441,
"speed_upload": 0,
"content_type": "text/html; charset=UTF-8",
"num_connects": 1,
"time_redirect": 0.0,
"num_redirects": 0,
"ssl_verify_result": 0,
"proxy_ssl_verify_result": 0,
"filename_effective": "/dev/null",
"remote_ip": "93.184.216.34",
"remote_port": 443,
"local_ip": "127.0.0.1",
"local_port": 61028,
"http_version": "1.1",
"scheme": "HTTPS",
"curl_version": "libcurl/7.72.0 SecureTransport zlib/1.2.11"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment