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

RE: Is it possible to convert a Json file to xml file with Git

From
Randall S. Becker <rsbecker@nexbridge.com>
Date
Oct 31, 2017, 21:52 UTC
Message-ID
<001801d35292$9871bd10$c9553730$@nexbridge.com>
In-Reply-To
<20171031212251.GB7777@alpha.vpn.ikke.info>
Show 6 quoted lines
> On October 31, 2017 5:23 PM, Kevin Daudt wrote:
> > On Tue, Oct 31, 2017 at 05:28:40PM +0000, Eyjolfur Eyjolfsson wrote:
> > I have a question.
> > Is it possible to convert a Json file to XML with Git
> 
> git is a version control system, which is mostly content agnostic. It
knows
> nothing about json or xml, let alone how to convert them.
> 
> You might want to use some kind of programming language to do the
> conversion.

Speculating... one possible reason to do this is during a protocol conversion effort, where definitions are moving from XML to JSON form. In legacy VCS systems, keeping interface definitions in one file and converting the content may be important. However, in git, with its concept of atomicity (multiple files are committed in a single version across the whole repository), dropping one file (e.g., XML) and adding another (e.g., JSON), can be done in one commit, and never lost or confused as to what is intended. This makes git ideal for modernization and evolutionary projects.

If, however, there is an application or systemic requirement to change the content of a file from XML to JSON without changing the name - I've seen it happen - you may want to consider building a smudge filter that understands the difference and maps between the two, to allow git diff operations between old and new formats. I would not recommend using this approach except as a last possible resort. Make a new file as Kevin intimated.

Just Musing on the Topic, Randall

-- Brief whoami: NonStop&UNIX developer since approximately UNIX(421664400)/NonStop(211288444200000000) -- In my real life, I talk too much.

Previous: Kevin DaudtNext: Eyjolfur Eyjolfsson
Message 3 of 5 in “Is it possible to convert a Json file to xml file with Git”
  1. Eyjolfur EyjolfssonOct 31, 2017
  2. Kevin DaudtOct 31, 2017
  3. Randall S. BeckerOct 31, 2017
  4. Eyjolfur EyjolfssonNov 1, 2017
  5. Jason PyeronNov 1, 2017

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.