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: curl --json has landed

From: Alex Bligh via curl-users <curl-users_at_lists.haxx.se>
Date: Sat, 5 Feb 2022 08:29:23 +0100

> On 4 Feb 2022, at 23:47, Daniel Stenberg via curl-users <curl-users_at_lists.haxx.se> wrote:
>
> On Fri, 4 Feb 2022, Balakrishnan Balasubramanian wrote:
>
>>> If you use multiple |--json| options on the same command line, the contents from them will be concatenated before sent off.
>>
>> I wonder why would that be useful. Concatenating two valid json objects will result in invalid json.
>
> Then... don't use it?
>
> I had to decide how to act when multiple --json options are used, and we already support multiple -d options for concatenation (even if slightly different). I could either let the second option override the first, or concatenate. I figured concatenate is slightly more useful.


Perhaps send the individual JSON elements as a JSON array?

EG {"a":1} and {"b":2} becomes [{"a":1}, {"b":2}]

That would seem more JSON friendly.

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