Converts XML to JSON and vice-versa using node-expat parser
Overall
score
93%
Generate XML for catalog-style data from either JSON strings or plain objects while respecting attribute mapping and text nodes.
catalog root containing item entries where each item includes primitive fields for attributes (e.g., id, price) and a $t field for the item text, return XML with an <catalog> root and <item> children whose primitive fields become attributes and $t values become element text. @testorder root that includes nested elements using $t for text (e.g., customer: { $t: "Jane" }) and additional primitive properties for attributes, produce XML where $t values become element text and primitive properties become attributes on the same element. @test<, >, &, ', ") in both attribute values and text nodes while keeping the structure unchanged. @test@generates
export interface CatalogXmlOptions {
sanitize?: boolean;
ignoreNull?: boolean;
}
export function buildCatalogXml(input: string | object, options?: CatalogXmlOptions): string;Handles XML generation from JSON structures with attribute and text node support.
Install with Tessl CLI
npx tessl i tessl/npm-xml2jsondocs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10