> JSON is a bad configuration format simply for the fact that it doesn't support comments. Some parsers do but most don't. XML for all its verbosity and complexity at least has comments where I can quickly try out configuration changes without needing to save the old configuration somewhere else.
Do this with libvirt please and report back how it went :)
Libvirt uses proper XML parser so that's almost certainly a non-issue. The problem with libvirt XML files is that they are snapshots, and that they lack obvious defaults.
What I mean with "snapshots" is that you can't edit an XML file for a running VM on disk, but instead have to go through either virt-manager or virsh dump/load function. If you do edit an existing XML file on disk, it will just overwrite it for you.
And XML format is a bit more verbose simply because XML schema writers make it so. SGML could be even nicer for human writers.
As for comments in JSON, many parsers are not strict and would let you insert arbitrary elements, so you might add {"comment":"whatevah"} where you need it.
I actually _do_ do this quite often.
Often w.r.t local changes (attaching network devices or storage devices).
If you fire up `virsh edit <resource>` you get a live view of the resource which can be updated in place. This is great to comment out some things and uncomment things for quick and dirty modifications. (some require a VM restart though).
That has to be a recent change, because editing the XML used to cause it to roundtrip through libvirt, which doesn't keep the XML DOM around; anything not in the internal C structs would be removed from the files, including all comments.
Weird, I've done it quite recently on a Debian system and it reformatted & removed everything it doesn't know from the XML. If you Google this, it's a common issue and apparently the reason why the top-level "metadata" tag was added, because that metadata-tag is carried around as DOM, so doesn't get purged.
Do this with libvirt please and report back how it went :)