본문으로 건너뛰기

XML to JSON 변환기

XML을 분석하여 다루기 쉬운 JSON 객체로 즉시 변환합니다.

브라우저에서 실행되며 데이터가 기기 외부로 전송되지 않습니다완전 무료, 회원가입 불필요
Options
JSON output

The converted JSON will appear here.

작동 방식

The input is first validated by a real XML validator, so structural problems like mismatched tags are reported with their line and column. The document is then parsed by the fast-xml-parser library: elements become JSON objects, attributes become @-prefixed keys, text content lands under #text, and repeated elements become arrays.

주요 기능

  • Input validated first, mismatched tags get line/column errors
  • Attribute support (@-prefixed keys) and #text content
  • Repeated elements become JSON arrays
  • Optional number/boolean conversion
  • 100% client-side, nothing leaves your browser

사용 방법

  1. Paste XML, or upload a .xml file.
  2. Choose indentation and whether to convert numbers and booleans.
  3. Press Convert to JSON, then copy the result or download it as a .json file.

예시

XML:
<deployment>
  <name>app</name>
  <replicas>4</replicas>
</deployment>

JSON:
{
  "deployment": {
    "name": "app",
    "replicas": 4
  }
}

자주 묻는 질문

How are XML attributes represented in the JSON?
Attributes appear under keys prefixed with @, and an element's text content under the key #text. For example, <a id="1">hi</a> becomes {"a": {"@_id": "1", "#text": "hi"}}. This is the standard convention of the underlying fast-xml-parser library, and it keeps attributes and child elements unambiguously separated.
Does the converter check that my XML is valid?
Yes. The input is validated before parsing, so mismatched tags, unclosed elements and other structural errors produce a clear message with the line and column where the problem was found. Nothing is converted until the XML passes validation.
Are numbers and booleans converted automatically?
By default, yes: <replicas>4</replicas> becomes 4, not "4", and true/false elements become booleans. You can turn this off to keep every value as a string.
What happens to repeated elements?
Repeated sibling elements become a JSON array: <ports><port>8080</port><port>8443</port></ports> becomes {"ports": {"port": [8080, 8443]}}. Note the flip side: an element that appears only once becomes a plain value, not a one-element array.
Are comments, CDATA and processing instructions preserved?
No. XML comments and processing instructions (including the <?xml?> declaration) are dropped, and CDATA sections are treated as ordinary text content, because none of them have a representation in JSON.
Is my data sent to a server?
No. Conversion happens entirely in your browser with JavaScript. Nothing you type or paste is transmitted anywhere, and you can verify this in your browser's network inspector.