git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Pretty output in JSON format

From
Ron Ziroby Romero <ziroby@gmail.com>
Date
Sep 24, 2024, 21:52 UTC
Message-ID
<CAGW8g7=21pPAgCixjpayEvmw_ns-hcB4e59NP476TKtCRXHPXQ@mail.gmail.com>
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

Next: brian m. carlson
Message 1 of 8 in “Pretty output in JSON format”
  1. Ron Ziroby RomeroSep 24, 2024
  2. brian m. carlsonSep 24, 2024
  3. Sean AllredSep 25, 2024
  4. brian m. carlsonSep 26, 2024
  5. Ron Ziroby RomeroSep 27, 2024
  6. Ron Ziroby RomeroJul 31, 2025
  7. Ron Ziroby RomeroAug 4, 2025
  8. Junio C HamanoAug 4, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.