XML to JSON (Free Online Tool)

Parse XML text into JSON for downstream normalization, validation, and reconciliation pipelines

Paste your JSON → Get results instantly (no signup)

⚡ Instant resultsNo signupRuns in your browser
Try examples:

Parse a bank statement XML into JSON for downstream reconciliation.

<BankStatement>
<Account>
<IBAN>DE89370400440532013000</IBAN>
<Currency>EUR</Currency>
</Account>
<Statement startDate="2026-05-01" endDate="2026-05-31">
<Balance type="opening" amount="1000.00"/>
<Balance type="closing" amount="1450.50"/>
<Transaction>
<Date>2026-05-15</Date>
<Amount currency="EUR">500.00</Amount>
<Description>Salary payment</Description>
<Reference>SAL-2026-05</Reference>
</Transaction>
<Transaction>
<Date>2026-05-20</Date>
<Amount currency="EUR">-49.50</Amount>
<Description>Grocery store</Description>
</Transaction>
</Statement>
</BankStatement>
 
Output
1{
2 "BankStatement": {
3 "Account": {
4 "IBAN": "DE89370400440532013000",
5 "Currency": "EUR"
6 },
7 "Statement": {
8 "@startDate": "2026-05-01",
9 "@endDate": "2026-05-31",
10 "Balance": [
11 {
12 "@type": "opening",
13 "@amount": 1000
14 },
15 {
16 "@type": "closing",
17 "@amount": 1450.5
18 }
19 ],
20 "Transaction": [
21 {
22 "Date": "2026-05-15",
23 "Amount": {
24 "@currency": "EUR",
25 "#text": 500
26 },
27 "Description": "Salary payment",
28 "Reference": "SAL-2026-05"
29 },
30 {
31 "Date": "2026-05-20",
32 "Amount": {
33 "@currency": "EUR",
34 "#text": -49.5
35 },
36 "Description": "Grocery store"
37 }
38 ]
39 }
40 }
41}

Love the result?

Use this exact pipeline in your app, backend, or LLM workflow.

No setup needed. Works with curl, Node, Python.

Uses example data. For edited input, copy from the playground.

Read integration guide

Works with:

  • API responses
  • Nested JSON
  • Arrays & objects

Example: input → output

Related tools

Advanced usage (optional)

XML to JSON

v1.0.0
Convert
string

Description

XML to JSON

Parse XML text into JSON. Designed as an ingress adapter for the ForgeJSON pipeline — once XML is JSON, every downstream utility (pick fields, validate schema, normalize, diff, redact) operates on it natively. Runs locally in your browser; no upload.

How It Works

Pastes raw XML in, gets a JSON tree out. Attributes become @attrName keys on the element. Numeric and boolean text content is coerced to native JSON types. Multi-child siblings with the same tag name are grouped into arrays.

This utility intentionally ships parse-only. It is not an XML platform: no XPath selectors, no XSD validation, no JSON-to-XML round-trip. The pipeline does the work after parsing.

Configuration

FieldTypeDefaultDescription
Preserve AttributesbooleantrueKeep XML attributes as @attrName keys in the JSON output
Coerce ValuesbooleantrueConvert numeric and boolean text into native JSON types
Array Modeenumautoauto = multi-child siblings become arrays. always = force every non-root element into an array (handy when downstream pipelines expect transactions[] even for one-transaction accounts)

Use Cases

Banking & Fintech

  • ISO 20022 / camt.053 statements: Parse SEPA / SWIFT statement XML into a JSON tree, then pick fields, normalize dates and amounts, and validate the downstream contract
  • Payment gateway reports: Adyen, Worldpay, and legacy gateway XML reports
  • Reconciliation feeds: Normalize multi-source XML into a comparable JSON shape for diff workflows

Enterprise Integration

  • SOAP responses: Strip SOAP envelopes, keep the payload as JSON for modern APIs
  • Legacy ERP / CRM exports: Convert XML-based exports into JSON for downstream warehouses, analytics, and AI tooling
  • EDI-adjacent formats: When EDI documents are XML-wrapped, this is the entry point

Common Pipeline Patterns

XML string
  → convert.xml-to-json
  → structure.pick-fields    (extract canonical shape)
  → convert.format-values    (coerce amounts to numbers, dates to ISO 8601)
  → validation.schema        (assert downstream contract)

Notes on XML Array Ambiguity

XML's notorious singular-vs-array ambiguity ( parses as txn: {} instead of txn: [{}]) makes downstream pipelines brittle. Use arrayMode: always when you want force-array behavior on every non-root element. A future release may add path-targeted force-array configuration for finer control.

Configuration

NameTypeDefaultDescription
Preserve AttributesbooleantrueKeep XML attributes as `@attrName` keys in the JSON output (disable to drop them entirely)
Array Modeenumautoauto: multi-child siblings become arrays, single children stay as objects. always: force every non-root element into an array — useful when downstream pipelines expect transactions[] even for accounts with one transaction. auto always
Coerce ValuesbooleantrueConvert numeric and boolean text into native JSON types (disable to keep all values as strings)

Examples

AI Prompt
Parse a bank statement XML into JSON for downstream reconciliation.
<BankStatement>
<Account>
<IBAN>DE89370400440532013000</IBAN>
<Currency>EUR</Currency>
</Account>
<Statement startDate="2026-05-01" endDate="2026-05-31">
<Balance type="opening" amount="1000.00"/>
<Balance type="closing" amount="1450.50"/>
<Transaction>
<Date>2026-05-15</Date>
<Amount currency="EUR">500.00</Amount>
<Description>Salary payment</Description>
<Reference>SAL-2026-05</Reference>
</Transaction>
<Transaction>
<Date>2026-05-20</Date>
<Amount currency="EUR">-49.50</Amount>
<Description>Grocery store</Description>
</Transaction>
</Statement>
</BankStatement>
 
Output
1{
2 "BankStatement": {
3 "Account": {
4 "IBAN": "DE89370400440532013000",
5 "Currency": "EUR"
6 },
7 "Statement": {
8 "@startDate": "2026-05-01",
9 "@endDate": "2026-05-31",
10 "Balance": [
11 {
12 "@type": "opening",
13 "@amount": 1000
14 },
15 {
16 "@type": "closing",
17 "@amount": 1450.5
18 }
19 ],
20 "Transaction": [
21 {
22 "Date": "2026-05-15",
23 "Amount": {
24 "@currency": "EUR",
25 "#text": 500
26 },
27 "Description": "Salary payment",
28 "Reference": "SAL-2026-05"
29 },
30 {
31 "Date": "2026-05-20",
32 "Amount": {
33 "@currency": "EUR",
34 "#text": -49.5
35 },
36 "Description": "Grocery store"
37 }
38 ]
39 }
40 }
41}
Config
Preserve Attributes
ON
Array Mode
auto
Coerce Values
ON

API Usage

POST /api/v1/utilities/convert.xml-to-json
Example:
curl -X POST https://your-domain.com/api/v1/utilities/convert.xml-to-json \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"primary":"<BankStatement>\n  <Account>\n    <IBAN>DE89370400440532013000</IBAN>\n    <Currency>EUR</Currency>\n  </Account>\n  <Statement startDate=\"2026-05-01\" endDate=\"2026-05-31\">\n    <Balance type=\"opening\" amount=\"1000.00\"/>\n    <Balance type=\"closing\" amount=\"1450.50\"/>\n    <Transaction>\n      <Date>2026-05-15</Date>\n      <Amount currency=\"EUR\">500.00</Amount>\n      <Description>Salary payment</Description>\n      <Reference>SAL-2026-05</Reference>\n    </Transaction>\n    <Transaction>\n      <Date>2026-05-20</Date>\n      <Amount currency=\"EUR\">-49.50</Amount>\n      <Description>Grocery store</Description>\n    </Transaction>\n  </Statement>\n</BankStatement>\n"},"config":{"preserveAttributes":true,"parseValues":true,"arrayMode":"auto"}}'
Response
1{
2 "BankStatement": {
3 "Account": {
4 "IBAN": "DE89370400440532013000",
5 "Currency": "EUR"
6 },
7 "Statement": {
8 "@startDate": "2026-05-01",
9 "@endDate": "2026-05-31",
10 "Balance": [
11 {
12 "@type": "opening",
13 "@amount": 1000
14 },
15 {
16 "@type": "closing",
17 "@amount": 1450.5
18 }
19 ],
20 "Transaction": [
21 {
22 "Date": "2026-05-15",
23 "Amount": {
24 "@currency": "EUR",
25 "#text": 500
26 },
27 "Description": "Salary payment",
28 "Reference": "SAL-2026-05"
29 },
30 {
31 "Date": "2026-05-20",
32 "Amount": {
33 "@currency": "EUR",
34 "#text": -49.5
35 },
36 "Description": "Grocery store"
37 }
38 ]
39 }
40 }
41}