flatmate - Your Friendly Data Flattener. Converted Nested JSON from an API into a List of Single-Depth Dictionaries for Writing to a CSV
Project description
flatmate
Your Friendly Data Flattener. Convert Nested JSON from an API into a List of Single-Depth Dictionaries for Writing to a CSV.
install
pip install flatmate
basic usage
# in JSON-compatible format
data = {
"agency": "GSA",
"measurementType": {
"method": "modules"
},
"version": "2.0.0",
"releases": [
{
"name": "usasearch",
"description": "System now maintained in open repo https://github.com/GSA/search-gov.",
"permissions": {
"licenses": None,
"usageType": "governmentWideReuse"
},
"tags": [
"GSA"
]
},
# ...
]
}
from flatmate import flatten
# flatten data into a list of flat single-depth dictionaries
flatten(data, start="releases")
[
{
"releases.name": "usasearch",
"releases.description": "System now maintained in open repo https://github.com/GSA/search-gov.",
"releases.permissions.licenses": "null",
"releases.permissions.usageType": "governmentWideReuse",
"releases.tags": "GSA",
# ...
},
# ...
]
advanced usage
coming soon
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
flatmate-0.0.0.tar.gz
(5.6 kB
view details)
File details
Details for the file flatmate-0.0.0.tar.gz.
File metadata
- Download URL: flatmate-0.0.0.tar.gz
- Upload date:
- Size: 5.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d7aa665f788273d53500ee2160ee1c08b82ec9a7f81cd3934c9551af0be67cf
|
|
| MD5 |
f138705ba8ef37222018a65c307e2dc8
|
|
| BLAKE2b-256 |
991dfd2bbe4384f380aa18ef0202428020acd604f95f654ba945b8d1a9298f8f
|