# flatmate
Your Friendly Data Flattener. Convert Nested JSON from an API into a List of Single-Depth Dictionaries for Writing to a CSV.
## install
```sh
pip install flatmate
```
## basic usage
```python
# 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"
]
},
# ...
]
}
```
```python
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
Raw data
{
"_id": null,
"home_page": "https://github.com/DanielJDufour/flatmate",
"name": "flatmate",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "csv, data, flat, flatten",
"author": "Daniel J. Dufour",
"author_email": "daniel.j.dufour@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/99/1d/fd2bbe4384f380aa18ef0202428020acd604f95f654ba945b8d1a9298f8f/flatmate-0.0.0.tar.gz",
"platform": null,
"description": "# flatmate\nYour Friendly Data Flattener. Convert Nested JSON from an API into a List of Single-Depth Dictionaries for Writing to a CSV.\n\n## install\n```sh\npip install flatmate\n```\n\n## basic usage\n```python\n# in JSON-compatible format\ndata = {\n \"agency\": \"GSA\",\n \"measurementType\": {\n \"method\": \"modules\"\n },\n \"version\": \"2.0.0\",\n \"releases\": [\n {\n \"name\": \"usasearch\",\n \"description\": \"System now maintained in open repo https://github.com/GSA/search-gov.\",\n \"permissions\": {\n \"licenses\": None,\n \"usageType\": \"governmentWideReuse\"\n },\n \"tags\": [\n \"GSA\"\n ]\n },\n # ...\n ]\n}\n```\n\n```python\nfrom flatmate import flatten\n\n# flatten data into a list of flat single-depth dictionaries\nflatten(data, start=\"releases\")\n[\n {\n \"releases.name\": \"usasearch\",\n \"releases.description\": \"System now maintained in open repo https://github.com/GSA/search-gov.\",\n \"releases.permissions.licenses\": \"null\",\n \"releases.permissions.usageType\": \"governmentWideReuse\",\n \"releases.tags\": \"GSA\",\n # ...\n },\n # ...\n]\n```\n\n# advanced usage\ncoming soon\n",
"bugtrack_url": null,
"license": null,
"summary": "flatmate - Your Friendly Data Flattener. Converted Nested JSON from an API into a List of Single-Depth Dictionaries for Writing to a CSV",
"version": "0.0.0",
"project_urls": {
"Download": "https://github.com/DanielJDufour/flatmate/tarball/download",
"Homepage": "https://github.com/DanielJDufour/flatmate"
},
"split_keywords": [
"csv",
" data",
" flat",
" flatten"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "991dfd2bbe4384f380aa18ef0202428020acd604f95f654ba945b8d1a9298f8f",
"md5": "f138705ba8ef37222018a65c307e2dc8",
"sha256": "1d7aa665f788273d53500ee2160ee1c08b82ec9a7f81cd3934c9551af0be67cf"
},
"downloads": -1,
"filename": "flatmate-0.0.0.tar.gz",
"has_sig": false,
"md5_digest": "f138705ba8ef37222018a65c307e2dc8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5613,
"upload_time": "2025-02-01T17:25:37",
"upload_time_iso_8601": "2025-02-01T17:25:37.516666Z",
"url": "https://files.pythonhosted.org/packages/99/1d/fd2bbe4384f380aa18ef0202428020acd604f95f654ba945b8d1a9298f8f/flatmate-0.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-01 17:25:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DanielJDufour",
"github_project": "flatmate",
"github_not_found": true,
"lcname": "flatmate"
}