Skip to main content

A small python package that unpacks data from a JSON url and converts it into a csv file.

Project description

jsonunwrap

jsonunwrap is a simple JSON flattening and normalization library.

>>> import jsonunwrap as ju
>>> url = "https://dummyjson.com/carts"
>>> fetchdata = ju.fetch_json(url)
>>> df = ju.unwrap_data(fetchdata)
>>> df.columns
Index(['id', 'user.name', 'hobbies'], dtype='object')
>>> len(df)
2

jsonunwrap allows you to deeply normalize complex, semi-structured nested JSON data into clean pandas DataFrames extremely easily.


Installing jsonunwrap

jsonunwrap is available on PyPI:

$ python -m pip install jsonunwrap

Supported Features & Best–Practices

jsonunwrap is ready for the data parsing demands of modern web APIs, automation scripts, and data engineering pipelines.

  • Recursive Deep-Flattening (Dot-notation formatting for sub-dictionaries)
  • Automated List Explosion (Spanning embedded primitive lists safely into unique rows)
  • Endpoint Target Binding (Fetch and write stream sequences in a single wrapper)
  • Clean API Namespace (Unified module boundaries with zero complex configuration maps)

Quick Usage Reference

Download, Normalize, and Export an API Stream to Disk

import jsonunwrap as ju

target_url = "url"
output_file = "data/normalized_users.csv"

# Fetch, unwrap nested schemas, and generate a local CSV payload
df = ju.json_to_csv(target_url, output_file)

Core API Documentation

The complete package interaction map exposes three primary interfaces:

jsonunwrap.unwrap_data(data)

Recursively flattens an in-memory dictionary or list of records. Returns a parsed pandas.DataFrame.

jsonunwrap.fetch_json(url, **kwargs)

A connection delivery utility utilizing the requests transport subsystem. Passes **kwargs onwards to target handlers.

jsonunwrap.json_to_csv(url, output_path)

High-level workflow coordinator connecting remote schema acquisition loops directly to a structural local CSV export.


Contributions & Testing

To test modifications locally or prepare adjustments, execute using pytest:

\$ git clone https://github.com/njuedominic/json-unwrap
\$ cd jsonunwrap
\(python -m pip install -e .[test]\) pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jsonunwrap-0.2.1.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jsonunwrap-0.2.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file jsonunwrap-0.2.1.tar.gz.

File metadata

  • Download URL: jsonunwrap-0.2.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for jsonunwrap-0.2.1.tar.gz
Algorithm Hash digest
SHA256 8d95339cc78872c6df826b886f1f932b26ff58482e03f04cb18d100f96c7bc22
MD5 08679372b5e6398d6d29b184f232de9b
BLAKE2b-256 78aad3eeed036d75095163872925e87c514a30800363c4d43e3a0cce10fe6452

See more details on using hashes here.

File details

Details for the file jsonunwrap-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: jsonunwrap-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for jsonunwrap-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 55c41efb854adc85a4edd7c4df3b1b91277dbf64f83f909a18234377b3c34999
MD5 2160c3cb6b76313363a472336afc7f2e
BLAKE2b-256 1bd9f4c50e16a744e53bd1dac3beafedb2ce3f6824e7bd2c436a31b272b04461

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page