From: David Ahern <dsahern@kernel.org>
To: Stephen Hemminger <stephen@networkplumber.org>,
Hadrien Patte <hadrien.patte@protonmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] json_writer: fix pretty printing of arrays
Date: Sun, 25 Oct 2026 13:42:41 -0600 [thread overview]
Message-ID: <65dc14b8-8e9f-4a70-8698-2bf12cbce5f0@kernel.org> (raw)
In-Reply-To: <20261025113418.2f5acab4@phoenix.local>
On 10/25/26 12:34 PM, Stephen Hemminger wrote:
> On Sat, 24 Oct 2026 18:50:46 +0000
> Hadrien Patte <hadrien.patte@protonmail.com> wrote:
>
>> On Fri, 23 Oct 2026 18:13:02 -0700
>> Stephen Hemminger <stephen@networkplumber.org> wrote:
>>
>>> Putting all the array elements on oneline is easier to read and more compact.
>>> What does python do?
>>
>> My current patch actually contains two separate changes:
>>
>> 1. A fix for arrays of objects. Scalar arrays render fine on a single
>> line, but when the elements are objects, which contain newlines, the
>> brackets and separators end up glued to them and the indentation
>> levels of opening and closing brackets are off:
>>
>> # ip -j -p addr show dev lo
>> [ {
>> "ifindex": 1,
>> "ifname": "lo",
>> "flags": [ "LOOPBACK","UP","LOWER_UP" ],
>> ...
>> "addr_info": [ {
>> "family": "inet",
>> "local": "127.0.0.1",
>> ...
>> },{
>> "family": "inet6",
>> "local": "::1",
>> ...
>> } ]
>> } ]
>>
>> 2. Putting each element of scalar arrays on its own line. This is a
>> style change rather than a fix, though it is consistent with common
>> JSON pretty-printers such as jq or python's json.dumps.
>>
>> I'm happy to send a v2 that only keeps the first part, leaving scalar
>> arrays in their current single-line form if you prefer.
>>
>> Thanks,
>> Hadrien
>>
>
> Looks ok, as is. more of an observation by me.
> I don't in general look at json pretty print
Meaning you are good with both changes? If so, Hadrien the 2 separate
changes should be 2 separate patches if possible.
prev parent reply other threads:[~2026-10-25 19:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 21:10 [PATCH iproute2-next] json_writer: fix pretty printing of arrays Hadrien Patte
2026-10-24 1:13 ` Stephen Hemminger
2026-10-24 18:50 ` Hadrien Patte
2026-10-25 18:34 ` Stephen Hemminger
2026-10-25 19:42 ` David Ahern [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=65dc14b8-8e9f-4a70-8698-2bf12cbce5f0@kernel.org \
--to=dsahern@kernel.org \
--cc=hadrien.patte@protonmail.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.