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: rs _ via curl-users <curl-users_at_lists.haxx.se>
Date: Tue, 22 Feb 2022 22:54:22 -0600

The current output is usually enormous and not parsable, so at the very
least it would be an improvement to have an enormous but parsable output.
For what it's worth, this small script mimics the intended behavior:

```
#! /usr/bin/env bash

raw=$(curl -i -w '\n%{json}' "$_at_")
json=$(printf "%s\n" "$raw" | tail -n1)
resp=$(printf "%s\n" "$raw" | head -n -1 | jq -s -R -c "{\"raw\": .}")

printf "%s\n" "$resp" | jq ". += $json"
```

I still think it would be extremely useful to have this output as an option
in curl (maybe as an additional <format>: %{json+full}), but maybe there is
not enough support for this feature.


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