curl格式化输出

当我们想使用 curl curl格式化输出一个 API 接口的 json 数据时,比如 curl http://localhost:8888/course -jq {“code”:200,”message”:”ok”,”data”:{“count”:4,”items”:[{“id”:”4342434343332″,”shop_id”:””,”image”:””,”title”:”Flutter实战训练营”,”content”:””,”duration”:0,”level”:0,”updated_at”:”2022-06-02T20:14:54+08:00″,”created_at”:”2022-06-02T20:16:05+08:00″},{“id”:”434243434333″,”shop_id”:””,”image”:””,”title”:”Erlang实战训练营”,”content”:””,”duration”:0,”level”:0,”updated_at”:”2022-06-02T20:14:37+08:00″,”created_at”:”2022-06-02T20:16:05+08:00″},{“id”:”4342434343″,”shop_id”:””,”image”:””,”title”:”Erlang实战”,”content”:””,”duration”:0,”level”:0,”updated_at”:”2022-06-02T20:14:09+08:00″,”created_at”:”2022-06-02T20:16:05+08:00″},{“id”:”4342″,”shop_id”:””,”image”:””,”title”:”Rust实战”,”content”:””,”duration”:0,”level”:0,”updated_at”:”2022-06-02T20:14:09+08:00″,”created_at”:”2022-06-02T20:16:05+08:00″}]}} 可以加点参数 curl http://localhost:8888/course |json_pp   这样就可以输出 curl 命令美化后的格式化 Json 数据了。   ➜ ~ curl http://localhost:8888/course |json_pp % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 813 100 813 0 0 101k 0 –:–:– –:–:– …

curl格式化输出 Read More »