Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Hadrien Patte <hadrien.patte@protonmail.com>
Cc: dsahern@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH iproute2-next] json_writer: fix pretty printing of arrays
Date: Sun, 25 Oct 2026 11:34:18 -0700	[thread overview]
Message-ID: <20261025113418.2f5acab4@phoenix.local> (raw)
In-Reply-To: <20261024183341.34161-1-hadrien.patte@protonmail.com>

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 

  reply	other threads:[~2026-10-25 18:34 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 [this message]
2026-10-25 19:42       ` David Ahern

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=20261025113418.2f5acab4@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dsahern@kernel.org \
    --cc=hadrien.patte@protonmail.com \
    --cc=netdev@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox