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

[RFC/PATCH 0/3] JSON/XML output for scripting interface

From
Julian Phillips <julian@quantumfyre.co.uk>
Date
Apr 11, 2010, 11:37 UTC
Message-ID
<20100411112928.80010.1786.julian@quantumfyre.co.uk>

Here is an attempt at making a format agnostic structured output library. The idea being that the command doing the output doesn't have to care what the actual output format is, it just uses the abstract notion of objects and arrays.

The current backend/frontend interface probably needs expanding so that a less noddy XML output can be used, but it's a start.

Rather than building an in-memory structure and then writing it out I've gone for the approach of writing out immediately. The thought behind this was that I didn't really want to force commands like log to have to wait 'til the end to start outputting information.

The JSON output is formatted differently from my previous JSON-only status modification, but the actual information output is the same (i.e. the output of a json parser should be identical ignoring item ordering in objects).

Julian Phillips (3):
  strbuf: Add strbuf_vaddf function
  add a library of code for producing structured output
  status: add support for structured output
 Makefile         |    3 +
 builtin/commit.c |   12 +++
 output-json.c    |  128 ++++++++++++++++++++++++++++++++
 output-xml.c     |   68 +++++++++++++++++
 output.c         |  212 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 output.h         |   71 ++++++++++++++++++
 strbuf.c         |   13 +++-
 strbuf.h         |    1 +
 wt-status.c      |   73 +++++++++++++++++++
 wt-status.h      |    2 +
 10 files changed, 581 insertions(+), 2 deletions(-)
 create mode 100644 output-json.c
 create mode 100644 output-xml.c
 create mode 100644 output.c
 create mode 100644 output.h
Next: Julian Phillips
Message 1 of 24 in “JSON/XML output for scripting interface”
  1. 0/3 JSON/XML output for scripting interfaceJulian Phillips, Apr 11, 2010
  2. 1/3 strbuf: Add strbuf_vaddf functionJulian Phillips, Apr 11, 2010
  3. Erik Faye-LundApr 11, 2010
  4. Julian PhillipsApr 11, 2010
  5. 2/3 add a library of code for producing structured outputJulian Phillips, Apr 11, 2010
  6. Erik Faye-LundApr 11, 2010
  7. Julian PhillipsApr 11, 2010
  8. Jakub NarebskiApr 11, 2010
  9. Junio C HamanoApr 11, 2010
  10. Sverre RabbelierApr 11, 2010
  11. Julian PhillipsApr 11, 2010
  12. Jakub NarebskiApr 11, 2010
  13. Julian PhillipsApr 11, 2010
  14. Eric RaymondApr 11, 2010
  15. 3/3 status: add support for structured outputJulian Phillips, Apr 11, 2010
  16. Sverre RabbelierApr 11, 2010
  17. Julian PhillipsApr 11, 2010
  18. Sverre RabbelierApr 11, 2010
  19. Julian PhillipsApr 11, 2010
  20. Sverre RabbelierApr 11, 2010
  21. Jon SeymourApr 11, 2010
  22. Eric RaymondApr 11, 2010
  23. Jon SeymourApr 11, 2010
  24. Julian PhillipsApr 11, 2010

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.