XML to JSON example 1
Input
<user><name>John</name></user>
Output
{"user":{"name":"John"}} Converts a simple XML structure into a JSON object.
Developer Tools
Review practical XML to JSON examples so you can understand expected input, output, and common patterns faster.
Use this XML to JSON converter to transform XML into JSON for APIs, debugging, data transformation, and development workflows. It is useful when moving data between XML-based and JSON-based systems without writing custom parsing code.
Example pages are especially useful for developer tools because they show what good input looks like, what kind of output to expect, and how the tool behaves in common scenarios.
Input
<user><name>John</name></user>
Output
{"user":{"name":"John"}} Converts a simple XML structure into a JSON object.
Input
<item id="1">Book</item>
Output
{"item":{"@attributes":{"id":"1"},"#text":"Book"}} Useful when XML attributes and text content both need to be preserved.
Fix: Validate or format the XML first before converting it.
Fix: Review the generated structure and reshape it afterward if your target app needs a different format.
Fix: Check how the tool represents attributes and text nodes before using the result.
After reviewing these examples, run the live tool with your own input. If your task involves a follow-up step, the related page can help you move to the next tool in the workflow.
Open the main XML to JSON page and test your own real input.