Loadingโฆ
Loadingโฆ
Convert JSON to well-formed XML, or XML to JSON, with attributes as @name keys. Invalid XML is reported with its exact line and column.
Also covers: JSON to XML ยท XML to JSON
The result appears here as you type.
JSON โ XML builds elements from keys; XML โ JSON turns elements into keys and repeated elements into arrays.
Paste JSON or XML, drop a file, or click Sample. XML is validated first, and errors point to the exact line and column.
Set the root element name, indentation, and whether to add an XML declaration. Copy, download, or Swap to convert the result back.
Keys starting with @ are attributes, and #text holds an element's text when it also has attributes. So {"link": {"@href": "/a", "#text": "Home"}} becomes <link href="/a">Home</link>, and the other way round. This is the same convention fast-xml-parser and many other tools use.
XML has no arrays, only repeated elements. One <item> becomes an object and two become an array, so the same schema can give either shape. If your code needs an array every time, normalize it after parsing.
XML names can't contain spaces or start with a digit. Such keys are made valid ("first name" โ first_name, "2fa" โ _2fa), and a note lists what was renamed.
An XML document must have exactly one root element. When the JSON is an array, a plain value, or an object with several top-level keys, it's wrapped in the root element name you choose.
No. Everything runs in your browser tab, and nothing you paste or open is uploaded or stored.
Data
Format, validate, and minify JSON in your browser. Paste it, upload a file, or load it from a URL. Errors show the exact line and column.
C# / .NET
Paste JSON and get C# model classes or records, ready for System.Text.Json or Newtonsoft.Json. Nested objects, arrays, nullable types, dates, and GUIDs are inferred for you.
TypeScript
Paste JSON and get TypeScript interfaces or type aliases, with nested objects named for you, optional and nullable fields detected from every array item, and union types.
SQL
Turn a JSON array into a CREATE TABLE with inferred column types and batched INSERT statements for PostgreSQL, MySQL, SQL Server, or SQLite.
SQL
Format and beautify SQL queries for SQL Server (T-SQL), PostgreSQL, MySQL, Oracle, and more. Set the indentation, keyword case, and layout, and get the exact line of any syntax error.
Data
Format, validate, and minify XML (config files, .csproj, SOAP, RSS) in your browser. Entities, CDATA, and mixed content are kept exactly as written, and errors show the line and column.