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: -w %{JSON}

From: Коваленко Анатолий Викторович via curl-users <>
Date: Fri, 22 May 2020 19:56:56 +0300

> On Thu, 21 May 2020, Коваленко Анатолий Викторович via curl-users wrote:

>> But I still do not know what the result will be in case of «-w %{JSON}» AND
>> another variables (content_type, filename_effective, etc) together. This is
>> not described in the manual.

> Sure it is described. They're all "variables" so you'll get them all output.
> But why would you do that if you want (valid) JSON?

For another options, reuse behavior is known. But not for full set in combination with particular
set. It is inconvenient.
Sometimes it is need to get one value quickly without parsing at the others (for example, for
debugging and screen output – one line but not dozens).
Such a combination can simply be wrong. How does the program respond to an input error?

>> And the JSON output will always be consist from ONE line? This is not
>> described in the manual too.

> It will be a valid JSON object and there's no guarantee or promise how many
> lines that is. It isn't something you should depend upon!

If there are multiple lines, how do I find the last one? Where is the beginning and where is the end
of the JSON object? What is the «JSON object» in terms of «MS PowerShell»? There is a string and an
array of strings. There are no «JSON objects». Test youself the property «.GetType()» of curl output
and be sure.
An what is the «JSON object» in «MS Cmd.exe»?

Received on 2020-05-22