Ever seen Htmlize? Invoked in an existing buffer, it produces a new buffer with the HTML-ized version of the original buffer contents.
I’d like something similar, but I want it for XML-to-JSON. (and Vice versa for bonus points).
Given an XML buffer, I’d like to produce an “equivalent” JSON buffer, constructed based on a few settings or assuumptions.
For example, starting with this:
<sample>
<text>This is the text</text>
</sample>
I’d like to get this:
{ "sample" : { "text" : "this is the text" } }
Handling of namespaces, attributes, and arrays… ideally it would all be configurable in some way. That would be in the settings somewhere. One option would be to simply strip xml namespaces. Another would be to append the xml namespace for an element in a named json property.
Does anything like this exist? Maybe it even exists as part of the built-in xml or js modes in emacs v24?
I’d rather grab someone else’s work! and not spend my evening tonight writing this. ….
Not that I’m aware of. But this may get you started: