A fast and efficient JSON to CSV converter
Project description
Fast JSON to CSV
Minimal dependencies fast and efficient JSON to CSV converter that doesn't rely on the standard CSV module. This package provides a simple way to convert JSON data to CSV format with support for nested JSON structures.
Features
- Convert JSON data to CSV format
- Handle nested JSON structures
- No dependency on Python's CSV module
- Support for custom delimiters
- Efficient memory usage
Installation
pip install fast-json-to-csv
Usage
from fast_json_to_csv import JsonToCSV
# Your JSON data
json_data = {
"name": "John",
"address": {
"city": "New York",
"zip": "10001"
}
}
# Convert to CSV
converter = JsonToCSV(json_data)
headers, body = converter.json_to_csv()
# Write to file
with open('output.csv', 'w') as f:
# Write headers
f.write(', '.join(headers))
f.write('\n')
# Write body
for row in body:
f.write(', '.join(row))
f.write('\n')
API Reference
JsonToCSV
The main class for converting JSON to CSV.
Methods
json_to_csv(): Converts the JSON data to CSV format, returns a tuple of (headers, body)flatten(d, prefix): Static method to flatten nested JSON structuresmerge_d(a, b): Static method to merge dictionaries
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fast_json_to_csv-0.1.0.tar.gz.
File metadata
- Download URL: fast_json_to_csv-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9c4407be4049a5ffbb988f717a64e797692e07d786cb91a267c56553f51cff55
|
|
| MD5 |
c9817295f05b7d13d2330da551724c93
|
|
| BLAKE2b-256 |
ea4f88651cfc7a788f0a9e9d9846b8e813c1d6ac910a6ce445572f26fb02e8da
|
File details
Details for the file fast_json_to_csv-0.1.0-py3-none-any.whl.
File metadata
- Download URL: fast_json_to_csv-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cccbb3f256e14a71ad22c75d71f0d2087047670001f5aecfaa656f355e8d8941
|
|
| MD5 |
af507fabc85f77e53eb2fd183d0c8c51
|
|
| BLAKE2b-256 |
8c72bf99e719644b1763102c90a11de29ec0f6ea081d00f7607001220148969e
|