CVS to JSONL example
✓ Published0🌍 Public
CCliffordAnderson
Last edited Nov 1, 2019
Created on Nov 1, 2019
This example shows a practical data-transformation workflow that converts a CSV file into JSONL format, producing one JSON object per line. It fetches a remote CSV file from a GitHub gist using the `fetch:text` function, parses it into records with `csv:parse`, and iterates through each record to build key-value pairs. The code distinguishes between integer and string values using `castable as xs:integer`, then constructs JSON maps with `xml-to-json` using XQuery 3.1. The output is unindented JSONL, suitable for streaming or line-oriented processing.
AI-generated description