{"uid":"cap_JLqqJO8kh9UJfie9VDDYL","slug":"saylor-innovations-xml-to-json-converter-64d89d33","name":"Saylor Innovations XML to JSON Converter","description":"Convert XML to JSON with attributes as @keys, repeated elements as arrays, CDATA and entities handled, using a parser that rejects DOCTYPE and entities","url":"https://saylorinnovations.com/api/convert/xml-to-json?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method","queryParams"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["xml"],"properties":{"xml":{"type":"string","description":"XML document, up to 12000 characters"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string","const":"json"},"example":{"type":"object","required":["root","json"],"properties":{"json":{"type":"object","properties":{"order":{"type":["object"],"properties":{"@id":{"type":["string"]},"item":{"type":["array"],"items":{"type":["object"],"properties":{"@sku":{"type":["string"]},"#text":{"type":["string"]}},"additionalProperties":true}},"note":{"type":["string"]}},"additionalProperties":true}},"description":"The document as JSON: attributes as @keys, text as #text, repeated elements as arrays","additionalProperties":true},"note":{"type":"string","description":"Caveat or context for reading the result"},"root":{"type":"string","description":"Name of the root element"},"source":{"type":"string","description":"Data source the values come from"},"elements":{"type":"number","description":"Number of elements parsed"},"max_depth":{"type":"number","description":"Max depth"},"checked_at":{"type":"string","description":"Time the check was run (UTC)"}},"additionalProperties":true},"description":{"type":"string"}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.01","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.01/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.01","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm__c5ycWObAnBW2JmyyzEzI","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.01","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts an XML document to JSON, mapping attributes as @keys, repeated elements as arrays, and handling CDATA, while rejecting DOCTYPE and external entities for safety.","exampleAgentPrompt":"Can you convert this XML to JSON for me? I've got a chunk of XML — attributes should become @keys, repeated elements should become arrays — here it is: <catalog><book id=\"1\"><title>The Way of Code</title></book><book id=\"2\"><title>Deep Systems</title></book></catalog>","exampleUseCases":[{"title":"Normalize SOAP API response","prompt":"I got a SOAP XML response back from a legacy API and need to work with it in my JavaScript app — can you convert it to JSON where attributes are @keys and repeated elements come through as arrays?"},{"title":"Parse RSS feed as JSON","prompt":"I have an RSS feed in XML format and want to process it as JSON. Can you convert the XML to JSON for me, handling any CDATA sections in the description fields?"},{"title":"Convert config XML to JSON","prompt":"I have a Maven pom.xml configuration file and I need to read it programmatically as JSON — please convert it to a JSON object with attributes as @keys and repeated dependency elements as arrays."}],"resultDescription":"Returns a JSON object containing the root element name, the full document parsed as a nested JSON object (XML attributes as @-prefixed keys, text content as #text, repeated sibling elements as arrays), the number of elements parsed, the maximum nesting depth, an optional note with caveats, and an optional source label. DOCTYPE declarations and external entities are rejected for security.","failureModes":["XML input exceeds 12,000 character limit — request rejected","Malformed or invalid XML returns a parse error","DOCTYPE declaration present in XML — rejected by security policy","External entity references (XXE) in XML — rejected by parser","Missing required 'xml' query parameter — validation error","Empty XML string — parse error"],"whenToPreferThis":"Choose this endpoint when you need a secure, structured XML-to-JSON conversion that safely rejects DOCTYPE and entity injection attacks (XXE prevention), faithfully represents XML attributes as @keys, collapses repeated sibling elements into arrays, and handles CDATA sections — especially useful for processing legacy API responses, SOAP payloads, RSS/Atom feeds, or configuration XML files up to 12,000 characters.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-12-02T12:18:22.987Z","isFirstParty":false,"canonicalSlug":"saylor-innovations-xml-to-json-converter-64d89d33"}