{"uid":"cap_UYGQTkPGLfu55-n2kiqKJ","slug":"24klabs-xml-json-converter-5522f298","name":"24KLabs XML↔JSON Converter","description":"Convert XML to JSON (attributes prefixed with @, text as #text, repeated tags become arrays) or JSON back to XML. Give from/to and the source string.","url":"https://api.24klabs.ai/api/xml-json-convert","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"to":{"type":"string"},"from":{"type":"string"},"input":{"type":"string"}}},"responseSchema":{"type":"json","example":{"result":{"note":{"to":"Ann","from":"Bo"}}}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.003","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.003/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.003","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_zLV-O_wk2yIdoLH8nL-me","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.003","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Bidirectionally converts between XML and JSON, mapping attributes with @ prefix, text content as #text, and repeated tags as arrays.","exampleAgentPrompt":"Convert this XML string to JSON for me — attributes should be prefixed with @ and text content as #text: '<root id=\"1\"><item>hello</item><item>world</item></root>'","exampleUseCases":[{"title":"Parse SOAP API XML response","prompt":"Take this SOAP XML response and convert it to JSON so I can work with it more easily — attributes should come through with @ prefix: '<GetUserResponse><User id=\"42\"><Name>Alice</Name><Email>alice@example.com</Email></User></GetUserResponse>'"},{"title":"Convert JSON config to XML for legacy system","prompt":"I need to send this JSON config to a legacy system that only accepts XML — can you convert it? Here's the JSON: {\"config\":{\"timeout\":30,\"retries\":3,\"endpoint\":\"https://api.example.com\"}}"},{"title":"Normalize repeated XML tags to JSON arrays","prompt":"Convert this XML product list to JSON — it has repeated <product> tags that should become an array: '<catalog><product id=\"1\"><name>Widget A</name></product><product id=\"2\"><name>Widget B</name></product></catalog>'"}],"resultDescription":"A converted string in the target format: if converting XML→JSON, returns a JSON object with attributes prefixed by @, text nodes as #text, and repeated sibling tags collapsed into arrays; if converting JSON→XML, returns a well-formed XML string.","failureModes":["Malformed XML input causes parse error","Invalid JSON input causes serialization failure","Missing or invalid 'from'/'to' direction parameter","Deeply nested or circular structures may not round-trip cleanly","Binary or non-UTF-8 encoded content may fail"],"whenToPreferThis":"Choose this endpoint when you need bidirectional XML↔JSON conversion with a specific, well-defined mapping convention (@ for attributes, #text for text nodes, arrays for repeated tags) — ideal for processing SOAP/RSS/Atom XML feeds, integrating with legacy XML APIs, or preparing JSON data for XML-only consumers. Prefer this over generic parsers when you need consistent, predictable attribute and text node handling.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:54:04.287Z","isFirstParty":false}