Skip to main content
100%

Comédie Française API

✓ Published0🌍 Public
CCliffordAnderson
Last edited Dec 11, 2015
Created on Dec 11, 2015

This example converts Comédie Française play data from JSON to XML, preserving metadata like author, title, and creation date. It shows how to transform API responses into structured XML documents for database storage. The code uses the XQuery `json-to-xml` function and `fetch:text` to retrieve and parse the JSON, then constructs custom `<play>` elements with attributes and child nodes. It optionally persists the results to a BaseX database via `db:add`, as seen in the commented-out line. The script demonstrates a direct data-cleaning workflow, with fields conditionally included based on presence in the source JSON.

AI-generated description

Similar vizzes