git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ron Ziroby Romero <ziroby@gmail.com>
To: git@vger.kernel.org
Subject: Pretty output in JSON format
Date: Tue, 24 Sep 2024 22:52:35 +0100	[thread overview]
Message-ID: <CAGW8g7=21pPAgCixjpayEvmw_ns-hcB4e59NP476TKtCRXHPXQ@mail.gmail.com> (raw)

Howdy git folk,

I want to revive the discussion on JSON output. I see a discussion in
2021 about it, but it didnt come to a resolution. That discussion was
talking about adding a --json flag. I have a slightly different
approach.

I see online that many people have tried to make various hacks to
convert git output into JSON, but they all lack completeness,
especially with log messages with arbitrary text. I believe the best
and most correct way to get JSON output from git is to add it as a new
format to the pretty option. Then, it would be easy to pipe the output
into something like jq to parse the JSON.  Trying to convert git's
output into JSON is a losing proposition. You've already lost some of
the context of the output by getting it out of the git program itself.
A pretty option would provide a standard way to get correct JSON
output, with git's code handling the weird corner cases.

What do y'all think?

Cheers,
Ron Ziroby Romero

             reply	other threads:[~2024-09-24 21:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-24 21:52 Ron Ziroby Romero [this message]
2024-09-24 22:06 ` Pretty output in JSON format brian m. carlson
2024-09-25 18:45   ` Sean Allred
2024-09-26 21:04     ` brian m. carlson
2024-09-27  6:49       ` Ron Ziroby Romero
     [not found]       ` <CANgJU+Xs-sQgAOCPL-5skaZGq7eHmhg0MaFGDr8N57=CK67iog@mail.gmail.com>
     [not found]         ` <CAGW8g7=xK0S-i_Ekfwwo_NjMbngO_5m4LERtWRhSCgA0vf+ZAg@mail.gmail.com>
2025-07-31 20:19           ` Ron Ziroby Romero
2025-08-04 20:39         ` Ron Ziroby Romero
2025-08-04 21:19           ` Junio C Hamano

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='CAGW8g7=21pPAgCixjpayEvmw_ns-hcB4e59NP476TKtCRXHPXQ@mail.gmail.com' \
    --to=ziroby@gmail.com \
    --cc=git@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;
as well as URLs for NNTP newsgroup(s).