I needed this a while back, for both JSON and XML.
JSON was the easy part =)
Here's my repo for an XML prettifier https://github.com/juztin/xmlfmt
* (ignore the install directions in my readme, the domain is wrong)*You
can install it via:
go get install https://github.com/juztin/xmlfmt
Then j
On Friday, November 4, 2016 at 2:32:24 PM UTC-7, Tong Sun wrote:
>
> How to beautify a given XML string in GO?
>
As someone who has spent a fair amount of time in the complexities of XML,
it is worth noting that XML is not equivalent to JSON in the context of
your question.
Only with a schema
You can try: https://godoc.org/github.com/clbanning/mxj#BeautifyXml
On Friday, November 4, 2016 at 3:32:24 PM UTC-6, Tong Sun wrote:
>
> How to beautify a given XML string in GO?
>
> The xml.MarshalIndent() only apply to a GO structure, not XML strings.
>
> Thanks
>
>
--
You received this mess