tessl install tessl/pypi-dicttoxml@1.7.0Converts a Python dictionary or other native data type into a valid XML string.
Agent Success
Agent success rate when using this tile
86%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.99x
Baseline
Agent success rate without this tile
87%
Convert nested catalog-style data into an XML document that preserves hierarchy across mappings and sequences.
{"departments": [{"name": "Books", "categories": [{"name": "Fiction", "products": ["Novel", "Shorts"]}]}]}, return an XML document rooted at catalog with an XML declaration and type metadata on each element. Nested content should appear as <catalog><departments type="list"><department>...<categories type="list"><category>...<products type="list"><product>Novel</product><product>Shorts</product></products></category></categories></department></departments></catalog>, preserving the hierarchy. @testroot_tag="inventory", include_types=False, and as_bytes=False on {"departments": []}, return a string starting with <inventory><departments></departments></inventory> (no type attributes anywhere). @test{"departments": [{"name": "Clothing", "categories": []}, {"name": "Electronics", "categories": [{"name": "Cameras", "products": []}]}]} should produce empty tags for the missing categories/products while keeping enclosing elements (e.g., <categories></categories> and <products></products>) without raising errors. @test@generates
from typing import Any, Mapping
def render_catalog_xml(
data: Mapping[str, Any],
*,
root_tag: str = "catalog",
include_types: bool = True,
as_bytes: bool = True,
singularize_items: bool = True,
):
"""Serialize nested catalog data into XML with predictable item naming."""Converts Python mappings and sequences into XML with optional metadata and configurable element naming. @satisfied-by