Flatten XML-derived JSON into analytic CSV rows

Internally mirrors XML→JSON→CSV so analysts keep predictable spreadsheets without custom ETL tooling.

Loading…
XML → CSV analytics notes
Clarifies when flattened rows appear vs needing manual reshaping.

Developer notes

• Irregular siblings may widen columns oddly — inspect intermediary JSON. • Namespace prefixes may disappear from headers. • Repeating elements (e.g. `<product>` siblings) become one CSV row per element once JSON is unwrapped. • Well-formed samples should include an XML declaration and indented markup so the language reads clearly. • **/fr/** CSV output uses `;` as the column separator for Numbers / Excel (EU locale). • Chunk giant feeds externally.

When teams pick this route

• BI ingestion of nightly XML dumps. • QA diffing SOAP exports versus CSV regression baselines. • Lightweight ETL previews.

About these options

CSV exports: choose a delimiter (Auto follows locale — semicolon on /fr), RFC-minimal vs always-quoted fields, line endings, and whether to emit a header row. CSV imports: delimiter + whether row 1 holds column names (Auto delimiter follows locale only for convenience). JSON output (XML, YAML, or CSV sources): indentation (including compact one-line) and optional recursive key sort. JSON → XML: toggle pretty-printing and indent width. YAML output: indent width, readable vs tighter layout, and deterministic string quoting (there is no source YAML file to “preserve”). XML comments are not represented in the intermediate JSON tree.

Worked examples

Product rows plus warehouse splits

Sample input

<?xml version="1.0" encoding="UTF-8"?> <rows> <product sku="X1"> <category>optic</category> <qty>12</qty> <warehouse>AMS</warehouse> </product> <product sku="X9"> <category>optic</category> <qty>3</qty> <warehouse>SIN</warehouse> </product> </rows>

Sample output

sku,category,qty,warehouse X1,optic,12,AMS X9,optic,3,SIN

Invoice header + dotted totals

Sample input

<?xml version="1.0" encoding="UTF-8"?> <invoice currency="EUR" period="Jan"> <meta> <source>ERP-22</source> <approved>true</approved> </meta> <totals net="449.99" tax="89.998" gross="539.988"/> </invoice>

Sample output

currency,period,meta.source,meta.approved,totals.net,totals.tax,totals.gross EUR,Jan,ERP-22,true,449.99,89.998,539.988

Navigate related converters

Review shape with XML → JSON, compress XML using XML minifier, or convert toward YAML via XML → YAML.

XML → CSV FAQ

Flattening quirks

Blank CSV?

Intermediary JSON might not expose rows — rerun through XML→JSON for inspection.

Column order?

Follows deterministic flatten traversal from nested JSON.

Works offline?

Yes once assets load — still no uploads.

SOAP attachments?

Not handled — preprocess MTOM payloads elsewhere.

Looking for every converter, encoder, and minifier in one place? Developer tools hub Open the curated developer tools catalogue.

XML to CSV — Structured Feeds Into Spreadsheet Columns