Each customer wants their own JSON

DataFileSplitter » Use cases » One JSON/XML document per customer

Download DataFileSplitter Free Trial »     Buy DataFileSplitter Now »

The situation

An export produced one JSON file with every customer's records in it - or an XML file with every tenant's elements under a single root. Each customer, tenant or account should receive their data as a document they can process, and ideally nobody gets anybody else's rows.

Cutting a JSON or XML file by size or by position does not work: a fragment of a JSON array is not valid JSON, and an XML document that has been cut in the middle is not well formed. Splitting has to happen at the level of the records, not the bytes.

What you do

  1. Choose the JSON, JSONL or XML file, and the field to split on - customer_id, tenant, account.
  2. Run the split. Every distinct value becomes its own file, named after that value, containing that customer's objects or elements.
  3. Hand each file to the person or system it belongs to.

Splitting a JSON file by column value with DataFileSplitter

Every output document is well formed: each JSON file is a complete array of that customer's objects, each XML file is a complete document with its root element - not a fragment. The input file does not have to be sorted by the field first, so records scattered through the file still land in the same output file.

What it will not do

Related

Guides: split JSON by column value, split XML by column value. Splitting tables instead: split by column value. Converting the parts: DataFileConverter. In the browser: split JSON, split XML.