Skip to main content

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

Metadata

Release files for flatmate 0.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flatmate 0.0.0
File Size Uploaded
flatmate-0.0.0.tar.gz 5.6 kB Details

Release files / flatmate-0.0.0.tar.gz

Download URL flatmate-0.0.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
1d7aa665f788273d53500ee2160ee1c08b82ec9a7f81cd3934c9551af0be67cf
BLAKE2b-256 checksum
How to use checksums
991dfd2bbe4384f380aa18ef0202428020acd604f95f654ba945b8d1a9298f8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release history Release notifications | RSS feed

This release

0.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page