curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: Feature request: Add 'content' field in -w %{json} output

From: Paul Gilmartin via curl-users <curl-users_at_lists.haxx.se>
Date: Wed, 23 Feb 2022 20:21:58 -0700

On Feb 23, 2022, at 19:39:15, rs _ wrote:
>
>> I haven't followed this thread closely, but was there an objection
> to piping normal curl output through a json filter?
>
> Are you referring to "piping" the output in curl itself or using an external program such as jq? I don't think the output of curl -w '\n%{json}' -D /dev/stdout 'https://example.com' can be read easily without additional work.

I was thinking of "an external program such as jq", as in the example on
<https://medium.com/how-tos-for-coders/https-medium-com-how-tos-for-coders-parse-json-data-using-jq-and-curl-from-command-line-5aa8a05cd79b>

   curl -s https://www.githubstatus.com/api/v2/status.json | jq '.'

That reproduces the example on that page.

Earlier I asked, "Is the "--dump-header <filename>" output available early enough
for a filter to base decisions on it.?" By experiment, the answer is, "Mostly."
It would be helpful to such a filter if curl closed the "<filename>" so that
such a filter could detect the end of the headers.

-- 
gil
-- 
Unsubscribe: https://lists.haxx.se/listinfo/curl-users
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2022-02-24