json-tools .ru

Python dict to CSV

Parses a list of Python dicts (a Django queryset.values() result, for example) and builds a CSV table from it.

Data requirements

Just like with JSON, CSV only comes out of a list of dicts or a single dict. The CSV headers are the union of every dict's keys in the order they appear, and a nested dict is flattened with a dot, like address.city.

True/False and nested lists

True/False are written into cells as the text true/false (CSV style, not Python style), and a list nested inside a dict stays a JSON string in the cell rather than becoming separate columns.

Format
Python → CSV
Source text Paste text or upload a file
Result Type is not detected yet
Statistics appear after formatting