https://daniel.haxx.se/blog/2020/03/17/curl-write-out-json/
例子如下:
{
"url_effective": "https://example.com/",
"http_code": 200,
"response_code": 200,
"http_connect": 0,
"time_total": 0.44054,
"time_namelookup": 0.001067,
"time_connect": 0.11162,
"time_appconnect": 0.336415,
"time_pretransfer": 0.336568,
"time_starttransfer": 0.440361,
"size_header": 347,
"size_request": 77,
"size_download": 1256,
"size_upload": 0,
"speed_download": 0.002854,
"speed_upload": 0,
"content_type": "text/html; charset=UTF-8",
"num_connects": 1,
"time_redirect": 0,
"num_redirects": 0,
"ssl_verify_result": 0,
"proxy_ssl_verify_result": 0,
"filename_effective": "saved",
"remote_ip": "93.184.216.34",
"remote_port": 443,
"local_ip": "192.168.0.1",
"local_port": 44832,
"http_version": "2",
"scheme": "HTTPS",
"curl_version": "libcurl/7.69.2 GnuTLS/3.6.12 zlib/1.2.11 brotli/1.0.7 c-ares/1.15.0 libidn2/2.3.0 libpsl/0.21.0 (+libidn2/2.3.0) nghttp2/1.40.0 librtmp/2.3"
}
如果所有 Unix 工具都能这样用 JSON 格式输出信息就好了。
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.