---
title: "XML to JSON"
method: POST
path: "/api/v1/tools/xml-to-json"
tags: ["tools"]
---

# XML to JSON

`POST /api/v1/tools/xml-to-json`

## Request

- Base URL: `https://toolforte.com`
- URL: `https://toolforte.com/api/v1/tools/xml-to-json`
- Auth: HTTP bearer

Parse XML into a JSON object keyed by the root element. Attributes become keys with a prefix ("@id"), text beside attributes or children lands under "#text", repeated elements become arrays, and namespace prefixes can be dropped. Malformed XML is reported with the line number; DTD-declared entities are not expanded.

## Request body

- object
  - `xml` string
  - `attributePrefix` string
  - `dropNamespaces` boolean
  - `indent` integer

## Response `200`

Successful result

- object
  - `ok` boolean
  - `data` object
    - `value` object
      - `order` object
        - `@id` string
        - `item` object[]
          - `@sku` string
          - `#text` string
    - `json` string
    - `elements` integer

## Other responses

- `400`: Missing or invalid request fields
- `401`: Invalid or missing API key
- `429`: Monthly plan limit reached

---

[API](https://skmtc.dev/toolforte/apis/toolforte-api.md) · [All operations](https://skmtc.dev/toolforte/apis/toolforte-api/llms.txt) · [OpenAPI document](https://skmtc.dev/toolforte/apis/toolforte-api/revisions/4d814d484dfc?raw)
