XML Input

Go Output

What Is XML to Go?

Go uses structs with encoding/xml for XML. This tool generates Go structs from your XML so you can unmarshal into typed data. Use encoding/xml to parse. The W3C XML spec defines the format; conversion runs in your browser. Nothing is sent to a server.

How to Use This Tool

1

Paste or Upload XML

Paste XML or upload a file. Set struct name, package, and XML tags in the config.

2

Review Go Output

The right panel shows generated structs. Use xml.Unmarshal to parse XML into these types.

3

Copy or Download

Use Copy or Download. For formatting XML first, use XML Formatter. For JSON conversion, use XML to JSON.

When XML to Go Helps

When building Go services that consume SOAP, RSS, or XML APIs, generate structs here. Use encoding/xml to unmarshal. The W3C XML spec defines the format.

XML to Go Examples

Here is an example of generating Go structs from XML.

Example: Subscriber record

XML input:

Input

Generated Go output:

Output

Frequently Asked Questions

XML tags on struct fields?

Enable XML Tags in config. The generator adds xml:"tagname" for correct unmarshaling.

Is my data sent anywhere?

No. Generation runs in your browser.

Related Tools

encoding/xml. W3C XML spec. MDN DOMParser. JSON spec. Go docs.