Skip to main content

A JSON-like object parsing tool for python

Project description

https://github.com/elisong/jparse/blob/master/jparse.png
Build Status PyPI PyPI - Python Version Coverage Status

This tool is created to make retrieving data from http response.json() or json library json.loads() easy. It helps to flatten, filter, select, update, and sort such objects, finally to_df (pandas.DataFrame format).

Simple Case

>>> from jparse import JParser
>>> jp = JParser()
>>> TEST_CASE1 = [{'A1': 1, 'A2': 2, 'A3': 3},
                  {'A1': [4, 5, 6], 'A2': 7, 'A3': 'x'}]
>>> print(jp.flatten(TEST_CASE1))
defaultdict(None, {'0_A1': 1,
                   '0_A2': 2,
                   '0_A3': 3,
                   '1_A1_0': 4,
                   '1_A1_1': 5,
                   '1_A1_2': 6,
                   '1_A2': 7,
                   '1_A3': 'x'})

Dependencies

Installation

pip install jparse

or

pip install git+https://github.com/elisong/jparse.git#egg=jparse

Document

Document here

Changelog

v0.1.8 - 2018-08-18

  • Change JParser.to_df by adding sort before to DataFrame

v0.1.7 - 2018-08-18

  • Remove collections.dafaultdict from japrse.py

v0.1.6 - 2018-08-18

  • Change pd.DataFrame() to pd.DataFrame.from_records() for JParser.to_df()
  • Change assert_frame_equal import for tests/test_to_df.py

v0.1.5 - 2018-08-18

  • Changed remove JParser.to_df() reset_index()

v0.1.4 - 2018-08-15

  • Changed license.

v0.1.3 - 2018-08-13

  • Added project.

Project details


Download files

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

Files for jparse, version 0.1.8
Filename, size & hash File type Python version Upload date
jparse-0.1.8-py2.py3-none-any.whl (7.5 kB) View hashes Wheel py2.py3
jparse-0.1.8.tar.gz (8.8 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page