XML ↔ JSON Converter

XML ↔ JSON Converter

Convert XML to explicit node JSON and back. Keep element order, attributes, mixed text, CDATA and comments distinct. DTD and external entity declarations are not supported.

Input and results are processed in browser memory; this tool does not upload or store them. Reloading clears them. Site-wide advertising and analytics may operate separately, but tool usage events do not contain your input or output.

Comments & questions

XML ↔ JSON Converter

Represent XML as ordered JSON nodes, including text interleaved with elements. Attributes live in attributes arrays and child nodes in children arrays, retaining repeated elements and text positions. Only this explicit node model converts back to XML; ordinary business JSON keys are not guessed as tag names.

Key features

  • Convert XML to explicit node JSON and back
  • Distinguish elements, attributes, text, CDATA, comments and processing instructions
  • Keep repeated elements and mixed text in node order
  • Validate XML syntax, namespaces and a single root; reject DTD declarations

How to use

  1. Select XML to JSON and enter a document with one root element.
  2. Run it and inspect the type, name, attributes and children node fields.
  3. To restore XML, paste the JSON result into the input and select JSON to XML.
  4. Copy and compare the content. The result is not guaranteed to match original file bytes.

Use cases

  • Inspect XML with emphasis tags and spaces inside sentences
  • Transfer repeated XML elements and attributes into ordered JSON
  • Create explicit XML structure fixtures and restore them

Frequently asked questions

Can any ordinary JSON object become XML?

Only this tool’s node model is supported. The document has type: document, declaration and children. An element has type: element, name, attributes and children. Convert the XML example first to obtain a valid template.

Are repeated names and spaces between inline tags retained?

The children array retains node order, including repeated sibling elements and intervening text. Text and CDATA are distinguished. XML output does not insert indentation into mixed text.

Will the XML match the original file exactly?

Byte-for-byte equality is not guaranteed. XML parsing may normalize line breaks, entity references and attribute whitespace; quoting and empty-element syntax may also change. This is not XML canonicalization for signatures or hashes.

Are DTD, external entities or XSD supported?

DTD and ENTITY declarations are rejected, and no external file or schema is fetched. XSD validation is not performed. The tool checks XML 1.0 declarations and the document syntax and namespaces supported by the browser parser.

Does XML containing script or style execute?

Input is read as a detached XML document and node data. Its nodes are never inserted into the current page, and output is displayed as text. The tool does not execute input scripts or apply linked styles.

What happens with invalid models or oversized input?

Unknown fields, unsupported node types, duplicate attributes and invalid comment or CDATA content are rejected. Input and generated XML are limited to 100,000 UTF-16 code units, with at most 10,000 nodes and 100 nesting levels.

Privacy

Input and results are processed in browser memory; this tool does not upload or store them. Reloading clears them. Site-wide advertising and analytics may operate separately, but tool usage events do not contain your input or output.

References

Related Tools

XML FormatterJSON ↔ YAML ConverterJSON Structure DiffWasm Module InspectorHreflang Matrix CheckerAST Query PlaygroundContainer Build GraphDependency Graph ExplorerSemver Range LabCron Schedule AuditorPatch Review WorkbenchSource Map ExplorerLocalization Catalog AuditorStructured Data ReviewerHTTP Archive AnalyzerWebhook Signature LabProtobuf Schema WorkbenchGraphQL Schema LabAvro Schema EvolutionLocal SQL WorkbenchSchema Form BuilderMesh Repair WorkbenchPipe Network LabRobot Arm Kinematics LabThermal Network LabBeam Response LabGear Train DesignerTolerance Stackup LabSensor Calibration FitPCB Stackup PlannerDigital Filter DesignerNetwork Reachability MapSun Shadow MapGPS Error SimulatorDigital Logic SimulatorAnalog Circuit LabMechanism Linkage LabAnalysis Mesh GeneratorOpenAPI Contract InspectorDatabase Migration PlannerDimensional Equation CheckerTruss Force LabBoolean Minimization LabControl Response LabQueueing Simulation LabGeofence Event SimulatorCoordinate Reference LabSurvey Traverse LabRaster Classification LabChoropleth Design LabMap Print ComposerRaster Reprojection LabElevation Contour MakerTerrain Viewshed LabWatershed DelineatorMap Tile PackagerText File Encoding WorkbenchFilesystem Portability AuditorSBOM License ExplorerFile Signature Auditornpm Lockfile Conflict ResolverSource Secret AuditorOffline Web Package BuilderCertificate Chain InspectorTorrent Metainfo InspectorChunked File PackagerEncrypted File VaultDuplicate File FinderArchive WorkbenchDesign Token ManagerSpacing Token DesignerResponsive Type SystemPackaging Dieline DesignerSVG Icon Sprite PackerFlex Layout PlaygroundCSS Grid PlaygroundRegex Equivalence LabMarkdown Repository AuditorLog Template MinerResponsive Layout AuditorEmail Template PreviewInternal Link GraphState Machine TesterPetri Net SimulatorGit History VisualizerCurl Request WorkbenchBinary Protocol DesignerHex File EditorBinary Patch WorkbenchFile Signature WorkbenchAPI Mock SandboxSchema Column MapperEvent Log SessionizerER Diagram DesignerTime Series Gap AuditorStratified Data SplitterData Lineage DesignerDecision Tree LabData Anonymization WorkbenchData Expectation RunnerJSON Schema ValidatorBasket Pattern AnalyzerRobots Policy TesterSEO HTML AuditorAccessibility Structure AuditorSyndication Feed WorkbenchIndexNow Payload BuilderCrawl Log AnalyzerCSP Policy WorkbenchSearch Performance AnalyzerCSV Formula Risk AuditorCORS Response SimulatorCache Header LabCookie Policy InspectorWeb Vitals Trace LabSitemap Health AuditorBatch File RenamerFile Manifest VerifierFolder Space MapFolder Difference ReviewerRoute Order OptimizerGeoJSON Map EditorPolygon Overlay LabCartographic Label PlacerSpatial Table JoinGeoJSON Topology AuditorGPX Track AnalyzerTrack Privacy RedactorCSV Table JoinCSV Pivot WorkbenchScientific Data ProfilerTabular Cleaning WorkbenchRecord ReconciliationData Dictionary BuilderCanonical Graph AuditorRedirect Plan TesterHTTP response and ping reference testBrowser and System InformationHTML FormatterJavaScript MinifierMock Data Generator.gitignore GeneratorLicense GeneratorUser-Agent ParserPassword Strength CheckerCode to ImageHTTP Status Code LookupMIME Type LookupJS & SQL String EscapeCSS Box Shadow GeneratorCSS Gradient GeneratorIndent ConverterNumber Base ConverterUnicode Escape ConverterUnicode InspectorMarkdown Table GeneratorBase64 EncoderJSON FormatterURL EncoderSQL FormatterCron Expression GeneratorRegex TesterUUID GeneratorHash GeneratorTimestamp ConverterJWT DecoderHTML Entity ConverterMarkdown PreviewCSS MinifierMeta Tag GeneratorJSON ↔ CSVCase ConverterImage to Base64
Explore all Dev Tools tools →Image/Media →Text/Convert →Life/Fun →