XML JSON Converter

Convert between XML and JSON formats, with formatting and customization options.

XML Input

Enter XML content to convert

JSON Output

Converted JSON content

Conversion Options

Customize conversion format and behavior

Format Info

XML: Markup language, hierarchical
JSON: Lightweight data interchange
Object Mode: Attributes to child elements
Array Mode: Attributes kept as attributes

Format Comparison

XML Features

Tag Structure: Uses start and end tags
Clear Hierarchy: Obvious nesting
Attributes: Elements can have attributes
Namespaces: Supports namespaces
Self-describing: Semantic tag names

JSON Features

Concise: No redundant tags
Data Types: Supports various types
Simple Parsing: Easy for programs
Web Friendly: Good for APIs
Widely Supported: Built-in support

Conversion Rules

XML → JSON:

XML Element → JSON Object
XML Attribute → JSON Attribute
XML Text → String Value
Empty Element → null or empty string

JSON → XML:

JSON Object → XML Element
JSON Array → Multiple Elements
JSON Attribute → XML Attribute
null → Empty Element