{"uid":"cap_0Bfd3B0gAYP3v1wqJGHIN","slug":"402utils-xml-to-json-converter-626c51ff","name":"402utils XML-to-JSON Converter","description":"Convert XML to clean JSON. POST raw XML (XML or text/plain Content-Type) or a JSON envelope {xml, alwaysArray}. Attributes land under \"@_\" keys, mixed-content text under \"#text\", repeated siblings become arrays, and alwaysArray forces arrays for listed tags even on a single occurrence. Numeric character references decode. DTD entities and DOCTYPE internal subsets rejected (anti-XXE / billion-laughs). Max 5 MB.","url":"https://402utils.com/v1/xml-to-json?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"xml":{"type":"string","description":"XML document to convert. Max 5 MB UTF-8. DTD entity declarations and DOCTYPE internal subsets are rejected (422)."},"alwaysArray":{"type":"array","items":{"type":"string"},"description":"Tag names that must always parse as arrays, even when only one occurrence exists (max 100)."}}},"responseSchema":{"type":"json","example":{"json":{"order":{"@_id":"A-17","item":[{"#text":"Café grinder","@_sku":"X1"},{"#text":"Filter","@_sku":"X2"}]}},"root":"order"}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","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":{"p10Cents":"0.2000","medianCents":"0.2000","p90Cents":"0.2000","minCents":"0.2000","maxCents":"0.2000","p95Cents":"0.2000","sampleCount":1,"varies":false,"failureChargeRate":1},"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_21mbIBbJqD1tTVXgfKUT6","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Converts raw XML documents to clean, structured JSON with attribute mapping, array coercion, and anti-XXE security protections","exampleAgentPrompt":"Convert this XML to JSON for me — make sure the 'item' and 'entry' tags always come back as arrays even if there's only one of them: <?xml version=\"1.0\"?><feed><entry><title>Hello</title></entry></feed>","exampleUseCases":null,"resultDescription":"A JSON object where XML elements become object keys, attributes are stored under '@_' keys, mixed-content text goes under '#text' keys, repeated sibling elements become arrays, and any tags listed in alwaysArray are always arrays even with a single occurrence. Numeric character references are decoded. DTD entities and DOCTYPE internal subsets are rejected with a 422 error.","failureModes":["XML exceeds 5 MB limit — request rejected","DTD entity declarations or DOCTYPE internal subsets present — rejected with 422 to prevent XXE/billion-laughs attacks","Malformed or non-well-formed XML — parse error returned","Invalid Content-Type (must be application/xml, text/plain, or application/json envelope)","alwaysArray list exceeds 100 tag names — rejected","Network timeout on large documents near the size limit"],"whenToPreferThis":"Use this endpoint when you need to convert XML to JSON with fine-grained control over attribute mapping and array coercion, especially when the source XML may have single-occurrence tags that should always parse as arrays. Prefer this over generic XML libraries when you need built-in XXE protection, a simple HTTP API without dependencies, and predictable '@_' attribute key conventions. Ideal for parsing SOAP responses, RSS/Atom feeds, configuration files, or any XML API response that needs to be consumed as JSON by downstream code.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-12T18:43:27.635Z","isFirstParty":false,"canonicalSlug":"402utils-xml-to-json-converter-626c51ff"}