Skip to content
PithLab

↑↓ to move · Enter to open · Esc to close

JSON to XML API

Convert JSON to XML. Keys with the attribute prefix (default @_) become attributes; arrays become repeated elements.

POST /api/v1/tools/json-to-xmlMCP json_to_xmlData & Conversion

Convert JSON to well-formed XML in your browser. Prefixed keys become attributes, arrays become repeated elements and special characters are escaped for you.

Input

Send these as a JSON object. Unknown fields are rejected.

input
The JSON text. (string, required)
rootName
Element that wraps the data when it has no single top-level key. (string, up to 100 characters, default "root")
attributePrefix
Keys starting with this prefix become XML attributes. (string, up to 10 characters, default "@_")
indent
Indentation: "0" for a single line, "2", "4" or "tab". (string, one of 0, 2, 4, tab, default "2")
declaration
Start with <?xml version="1.0" encoding="UTF-8"?>. (boolean, default false)
curl https://pithlab.com/api/v1/tools/json-to-xml \n  -H "Authorization: Bearer $PITHLAB_KEY" \n  -H "Content-Type: application/json" \n  -d '{"input":"{\"book\":{\"@_id\":\"1\",\"title\":\"Dune\",\"authors\":[\"Frank Herbert\"]}}"}'