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

[PATCH v3] routines to generate JSON data

From
Ggit@jeffhostetler.com <git@jeffhostetler.com>
Date
Mar 23, 2018, 16:29 UTC
Message-ID
<20180323162952.81443-1-git@jeffhostetler.com>
From: Jeff Hostetler <jeffhost@microsoft.com>
This is version 3 of my JSON data format routines.

This version addresses the variable name changes in [v2] and adds additional test cases. I also changed the BUG() calls to die() to help with testing.

The json-writer routines can be used generate structured data in a JSON-like format. I say "JSON-like" because we don't enforce the Unicode/UTF-8 requirement [3,4] on string values. This was discussed on the mailing list in the [v1] and [v2] threads, but to summarize here: Git doesn't know if various fields, such as Unix pathnames and author names, are Unicode or just 8-bit character data, so Git would not know how to properly encode such fields and the consumer of such output would not know these strings were encoded (once or twice). So, until we have a pressing need to generate proper Unicode data, we avoid it for now.

The initial use for the json-writer routines is for generating telemetry data for executed Git commands. Later, we might want to use them in other commands such as status.

[v1] https://public-inbox.org/git/20180316194057.77513-1-git@jeffhostetler.com/ [v2] https://public-inbox.org/git/20180321192827.44330-1-git@jeffhostetler.com/ [3] http://www.ietf.org/rfc/rfc7159.txt [4] http://json.org/

Jeff Hostetler (1):
  json_writer: new routines to create data in JSON format
 Makefile                    |   2 +
 json-writer.c               | 321 +++++++++++++++++++++++++++++++++
 json-writer.h               |  86 +++++++++
 t/helper/test-json-writer.c | 420 ++++++++++++++++++++++++++++++++++++++++++++
 t/t0019-json-writer.sh      | 213 ++++++++++++++++++++++
 5 files changed, 1042 insertions(+)
 create mode 100644 json-writer.c
 create mode 100644 json-writer.h
 create mode 100644 t/helper/test-json-writer.c
 create mode 100755 t/t0019-json-writer.sh
-- 
2.9.3
Next: git@jeffhostetler.com
Message 1 of 7 in “routines to generate JSON data”
  1. routines to generate JSON datagit@jeffhostetler.com, Mar 23, 2018
  2. json_writer: new routines to create data in JSON formatgit@jeffhostetler.com, Mar 23, 2018
  3. Jonathan NiederMar 23, 2018
  4. Jeff HostetlerMar 23, 2018
  5. Jonathan NiederMar 23, 2018
  6. Ramsay JonesMar 23, 2018
  7. Jeff HostetlerMar 23, 2018

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.