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/products"
>>> fetchdata = ju.fetch_json(url)
>>> df = ju.unwrap_data(fetchdata)
>>> df.columns
Index(['id', 'title', 'description', 'category', 'price', 'discountPercentage',
       'rating', 'stock', 'tags', 'brand', 'sku', 'weight',
       'warrantyInformation', 'shippingInformation', 'availabilityStatus',
       'returnPolicy', 'minimumOrderQuantity', 'images', 'thumbnail',
       'dimensions.width', 'dimensions.height', 'dimensions.depth',
       'meta.createdAt', 'meta.updatedAt', 'meta.barcode', 'meta.qrCode',
       'rating_reviews', 'comment', 'date', 'reviewerName', 'reviewerEmail'],
      dtype='object')
>>> len(df)
3771

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: jsonunwrap-0.2.3.tar.gz
  • Upload date:
  • Size: 4.6 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.3.tar.gz
Algorithm Hash digest
SHA256 721defb4dbf3e1ee118e8c4014843b4e8c4070e39628e1165ba6b1d2ecc010cf
MD5 beb65225f81947bf10b2d54447b3651f
BLAKE2b-256 49010249250c345e114fe1026010ada6597696824b703ab51fde0ba59f593d39

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jsonunwrap-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 dc7fa4f43755215accfd33cdb9acce542beb0bc766fe2a29ce713c25c7c33ab8
MD5 378216f7869b4eb2927d8ad604886cab
BLAKE2b-256 232dce581635f1d52764c5eb8205005ac250d529f4df0d97b9112d079015d158

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