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.2.tar.gz (4.4 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.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jsonunwrap-0.2.2.tar.gz
  • Upload date:
  • Size: 4.4 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.2.tar.gz
Algorithm Hash digest
SHA256 37885d9c1b57c1d521297f74f6eedd33551d3e6b309bee1b42e2ece2589d1fc7
MD5 db3fe84556ec491c807dfdf6b67a064e
BLAKE2b-256 a2d538b47646272746e93be3e303893049c0b8d56fdfbd20432a8d17e9c35205

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonunwrap-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d331e923637b6f917dc5fb3ffbc6aa9b7919ffa7692afc98fb1fb8c59b146ea1
MD5 b1a821b1a62a3abdb135894242f6c595
BLAKE2b-256 ab35c2e94e78999ef24f1a02ac5bfc329025ba0d7be9587e5a4260681fe6df72

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