{ "info": { "author": "Tim Phillips", "author_email": "phillipstr@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Utilities" ], "description": "JSON Flatten\n============\n\n.. image:: https://img.shields.io/pypi/v/jsonflatten.svg\n :target: https://pypi.python.org/pypi/jsonflatten\n :alt: Latest PyPI version\n\n.. image:: https://travis-ci.org/borntyping/cookiecutter-pypackage-minimal.png\n :target: https://travis-ci.org/borntyping/cookiecutter-pypackage-minimal\n :alt: Latest Travis CI build status\n\nA JSON document flattening tool\n\n.. code-block:: console\n\n $ jsonflatten --help\n\n Usage: jsonflatten [OPTIONS] [JSONFILE]\n\n Specify which keys or whole document to flatten\n\n Options:\n -f, --flatten TEXT Flatten only those specified keys generated from\n `jsoncut -l` option as a comma-separated list or\n idividually, i.e. `-f7,9` or `-f7 -f9`\n -n, --nocolor Disable syntax highlighting\n -q, --quotechar TEXT Quote character used in serialized data, defaults to\n '\"'\n -s, --slice Disable sequencer\n --version Show the version and exit.\n --help Show this message and exit.\n\nInstallation\n------------\n.. code-block:: console\n\n $ pip install jsonflatten\n\nUsage\n-----\n* **Python 3 support only**; *jsonflatten is not currently supported under Python 2*.\n* jsonflatten is meant to be used alongside `jsoncut `_.\n* Flatten the entire JSON document by not setting any command-line options.\n* Flatten specified keys in the JSON document using the -f option.\n* jsonflatten functions can also be imported into your own programs or scripts.\n\nSample Data\n-----------\n* forecast.json - three day weather forecast API data\n\n.. code-block:: console\n\n {\n \"status\":\"200\",\n \"datetime\": \"2017-09-09 11:49\",\n \"request_type\": \"3-day Forecast\",\n \"list\": [\n {\n \"date\": \"2017-09-09\",\n \"sunrise\": \"07:04\",\n \"sunset\": \"19:31\",\n \"moonrise\": \"22:07\",\n \"moonset\": \"10:11\",\n \"temp_f_min\": 81,\n \"temp_f_max\": 85,\n \"day\": {\n \"humidity_pct\": 82,\n \"uv_index\": 5,\n \"weather\": {\n \"description\": \"Heavy Rain/Wind\",\n \"summary\": \"Tropical storm conditions likely. Rain showers will bring heavy downpours and strong gusty winds at times.\",\n \"icon\":\"04d\"\n }, \"wind\": {\n \"speed_ave_mph\": 49,\n \"speed_low_mph\": 40,\n \"speed_high_mph\": 60,\n \"direction\": \"ENE\"\n }, \"rain\": {\n \"precip_pct\": 100,\n \"low_inches\": 1,\n \"high_inches\": 2\n }\n }, \"night\": {\n \"humidity_pct\": 82,\n \"weather\": {\n \"description\": \"Heavy Rain/Wind\",\n \"summary\": \"Major hurricane conditions likely. Bands of heavy rain containing strong gusty winds at times.\",\n \"icon\":\"04d\"\n }, \"wind\": {\n \"speed_ave_mph\": 120,\n \"speed_low_mph\": 115,\n \"speed_mph\": 130,\n \"direction\": \"ENE\"\n }, \"rain\": {\n \"precip_pct\": 100,\n \"low_inches\": 5,\n \"high_inches\": 8\n }\n }\n }, {\n \"date\": \"2017-10-09\",\n \"sunrise\": \"07:04\",\n \"sunset\": \"19:30\",\n \"moonrise\": \"22:51\",\n \"moonset\": \"11:12\",\n \"temp_f_min\": 79,\n \"temp_f_max\": 85,\n \"day\": {\n \"humidity_pct\": 84,\n \"uv_index\": 5,\n \"weather\": {\n \"description\": \"Heavy Rain/Wind\",\n \"summary\": \"Major hurricane conditions likely. Bands of heavy rain containing strong gusty winds at times.\",\n \"icon\":\"04d\"\n }, \"wind\": {\n \"speed_ave_mph\": 117,\n \"speed_low_mph\": 115,\n \"speed_mph\": 130,\n \"direction\": \"SE\"\n }, \"rain\": {\n \"precip_pct\": 100,\n \"low_inches\": 1,\n \"high_inches\": 2\n }\n }, \"night\": {\n \"humidity_pct\": 83,\n \"weather\": {\n \"description\": \"Thunderstorms/Wind\",\n \"summary\": \"Tropical storm conditions likely. Windy with bands of heavy rain showers and thunderstorms.\",\n \"icon\":\"04d\"\n }, \"wind\": {\n \"speed_ave_mph\": 71,\n \"speed_low_mph\": 60,\n \"speed_mph\": 80,\n \"direction\": \"SSW\"\n }, \"rain\": {\n \"precip_pct\": 100,\n \"low_inches\": 1,\n \"high_inches\": 2\n }\n }\n }, {\n \"date\": \"2017-11-09\",\n \"sunrise\": \"0705\",\n \"sunset\": \"1929\",\n \"moonrise\": \"2339\",\n \"moonset\": \"1213\",\n \"temp_f_min\": 77,\n \"temp_f_max\": 90,\n \"day\": {\n \"humidity_pct\": 72,\n \"uv_index\": 9,\n \"weather\": {\n \"description\": \"Partly Cloudy/Wind\",\n \"summary\": \"Windy. Mostly cloudy skies will become partly cloudy in the afternoon.\",\n \"icon\":\"03d\"\n }, \"wind\": {\n \"speed_ave_mph\": 16,\n \"speed_low_mph\": 10,\n \"speed_high_mph\": 20,\n \"direction\": \"WSW\"\n }, \"rain\": {\n \"precip_pct\": 20,\n \"low_inches\": 1,\n \"high_inches\": 2\n }\n }, \"night\": {\n \"humidity_pct\": 82,\n \"weather\": {\n \"description\": \"Partly cloudy\",\n \"summary\": \"A few clouds.\",\n \"icon\":\"04d\"\n }, \"wind\": {\n \"speed_ave_mph\": 16,\n \"speed_low_mph\": 10,\n \"speed_mph\": 20,\n \"direction\": \"WSW\"\n }, \"rain\": {\n \"precip_pct\": 10,\n \"low_inches\": null,\n \"high_inches\": null\n }\n }\n }\n ], \"city\": {\n \"id\": 4164138,\n \"name\": \"Miami\",\n \"coord\": {\n \"lat\": 25.7743,\n \"lon\": -80.1937\n },\n \"country\": \"US\"\n }\n }\n\nFlatten Entire JSON Document\n----------------------------\n.. code-block:: console\n\n $ jsonflatten forecast.json\n\n.. code-block:: console\n\n {\n \"city.coord.lat\": 25.7743,\n \"city.coord.lon\": -80.1937,\n \"city.country\": \"US\",\n \"city.id\": 4164138,\n \"city.name\": \"Miami\",\n \"datetime\": \"2017-09-09 11:49\",\n \"list\": [\n {\n \"date\": \"2017-09-09\",\n \"day.humidity_pct\": 82,\n \"day.rain.high_inches\": 2,\n \"day.rain.low_inches\": 1,\n \"day.rain.precip_pct\": 100,\n \"day.uv_index\": 5,\n \"day.weather.description\": \"Heavy Rain/Wind\",\n \"day.weather.icon\": \"04d\",\n \"day.weather.summary\": \"Tropical storm conditions likely. Rain showers will bring heavy downpours and strong gusty winds at times.\",\n \"day.wind.direction\": \"ENE\",\n \"day.wind.speed_ave_mph\": 49,\n \"day.wind.speed_high_mph\": 60,\n \"day.wind.speed_low_mph\": 40,\n \"moonrise\": \"22:07\",\n \"moonset\": \"10:11\",\n \"night.humidity_pct\": 82,\n \"night.rain.high_inches\": 8,\n \"night.rain.low_inches\": 5,\n \"night.rain.precip_pct\": 100,\n \"night.weather.description\": \"Heavy Rain/Wind\",\n \"night.weather.icon\": \"04d\",\n \"night.weather.summary\": \"Major hurricane conditions likely. Bands of heavy rain containing strong gusty winds at times.\",\n \"night.wind.direction\": \"ENE\",\n \"night.wind.speed_ave_mph\": 120,\n \"night.wind.speed_low_mph\": 115,\n \"night.wind.speed_mph\": 130,\n \"sunrise\": \"07:04\",\n \"sunset\": \"19:31\",\n \"temp_f_max\": 85,\n \"temp_f_min\": 81\n },\n {\n \"date\": \"2017-10-09\",\n \"day.humidity_pct\": 84,\n \"day.rain.high_inches\": 2,\n \"day.rain.low_inches\": 1,\n \"day.rain.precip_pct\": 100,\n \"day.uv_index\": 5,\n \"day.weather.description\": \"Heavy Rain/Wind\",\n \"day.weather.icon\": \"04d\",\n \"day.weather.summary\": \"Major hurricane conditions likely. Bands of heavy rain containing strong gusty winds at times.\",\n \"day.wind.direction\": \"SE\",\n \"day.wind.speed_ave_mph\": 117,\n \"day.wind.speed_low_mph\": 115,\n \"day.wind.speed_mph\": 130,\n \"moonrise\": \"22:51\",\n \"moonset\": \"11:12\",\n \"night.humidity_pct\": 83,\n \"night.rain.high_inches\": 2,\n \"night.rain.low_inches\": 1,\n \"night.rain.precip_pct\": 100,\n \"night.weather.description\": \"Thunderstorms/Wind\",\n \"night.weather.icon\": \"04d\",\n \"night.weather.summary\": \"Tropical storm conditions likely. Windy with bands of heavy rain showers and thunderstorms.\",\n \"night.wind.direction\": \"SSW\",\n \"night.wind.speed_ave_mph\": 71,\n \"night.wind.speed_low_mph\": 60,\n \"night.wind.speed_mph\": 80,\n \"sunrise\": \"07:04\",\n \"sunset\": \"19:30\",\n \"temp_f_max\": 85,\n \"temp_f_min\": 79\n },\n {\n \"date\": \"2017-11-09\",\n \"day.humidity_pct\": 72,\n \"day.rain.high_inches\": 2,\n \"day.rain.low_inches\": 1,\n \"day.rain.precip_pct\": 20,\n \"day.uv_index\": 9,\n \"day.weather.description\": \"Partly Cloudy/Wind\",\n \"day.weather.icon\": \"03d\",\n \"day.weather.summary\": \"Windy. Mostly cloudy skies will become partly cloudy in the afternoon.\",\n \"day.wind.direction\": \"WSW\",\n \"day.wind.speed_ave_mph\": 16,\n \"day.wind.speed_high_mph\": 20,\n \"day.wind.speed_low_mph\": 10,\n \"moonrise\": \"2339\",\n \"moonset\": \"1213\",\n \"night.humidity_pct\": 82,\n \"night.rain.high_inches\": null,\n \"night.rain.low_inches\": null,\n \"night.rain.precip_pct\": 10,\n \"night.weather.description\": \"Partly cloudy\",\n \"night.weather.icon\": \"04d\",\n \"night.weather.summary\": \"A few clouds.\",\n \"night.wind.direction\": \"WSW\",\n \"night.wind.speed_ave_mph\": 16,\n \"night.wind.speed_low_mph\": 10,\n \"night.wind.speed_mph\": 20,\n \"sunrise\": \"0705\",\n \"sunset\": \"1929\",\n \"temp_f_max\": 90,\n \"temp_f_min\": 77\n }\n ],\n \"request_type\": \"3-day Forecast\",\n \"status\": \"200\"\n }\n\nFlatten Only Specific Keys\n--------------------------\n.. code-block:: console\n\n $ cat forecast.json | jsoncut -l\n 1 city\n 2 city.coord\n 3 city.coord.lat\n 4 city.coord.lon\n 5 city.country\n 6 city.id\n 7 city.name\n 8 datetime\n 9 list\n 10 request_type\n 11 status\n\n.. code-block:: console\n\n $ cat forecast.json | jsonflatten -f3,4,7\n {\n \"city.coord.lat\": 25.7743,\n \"city.coord.lon\": -80.1937,\n \"city.name\": \"Miami\"\n }\n\n.. code-block:: console\n\n $ cat forecast.json | jsonflatten -f7 -f9\n {\n \"city.name\": \"Miami\",\n \"list\": [\n {\n \"date\": \"2017-09-09\",\n \"day.humidity_pct\": 82,\n \"day.rain.high_inches\": 2,\n \"day.rain.low_inches\": 1,\n \"day.rain.precip_pct\": 100,\n \"day.uv_index\": 5,\n \"day.weather.description\": \"Heavy Rain/Wind\",\n \"day.weather.icon\": \"04d\",\n \"day.weather.summary\": \"Tropical storm conditions likely. Rain showers will bring heavy downpours and strong gusty winds at times.\",\n \"day.wind.direction\": \"ENE\",\n \"day.wind.speed_ave_mph\": 49,\n \"day.wind.speed_high_mph\": 60,\n \"day.wind.speed_low_mph\": 40,\n \"moonrise\": \"22:07\",\n \"moonset\": \"10:11\",\n \"night.humidity_pct\": 82,\n \"night.rain.high_inches\": 8,\n \"night.rain.low_inches\": 5,\n \"night.rain.precip_pct\": 100,\n \"night.weather.description\": \"Heavy Rain/Wind\",\n \"night.weather.icon\": \"04d\",\n \"night.weather.summary\": \"Major hurricane conditions likely. Bands of heavy rain containing strong gusty winds at times.\",\n \"night.wind.direction\": \"ENE\",\n \"night.wind.speed_ave_mph\": 120,\n \"night.wind.speed_low_mph\": 115,\n \"night.wind.speed_mph\": 130,\n \"sunrise\": \"07:04\",\n \"sunset\": \"19:31\",\n \"temp_f_max\": 85,\n \"temp_f_min\": 81\n },\n {\n \"date\": \"2017-10-09\",\n \"day.humidity_pct\": 84,\n \"day.rain.high_inches\": 2,\n \"day.rain.low_inches\": 1,\n \"day.rain.precip_pct\": 100,\n \"day.uv_index\": 5,\n \"day.weather.description\": \"Heavy Rain/Wind\",\n \"day.weather.icon\": \"04d\",\n \"day.weather.summary\": \"Major hurricane conditions likely. Bands of heavy rain containing strong gusty winds at times.\",\n \"day.wind.direction\": \"SE\",\n \"day.wind.speed_ave_mph\": 117,\n \"day.wind.speed_low_mph\": 115,\n \"day.wind.speed_mph\": 130,\n \"moonrise\": \"22:51\",\n \"moonset\": \"11:12\",\n \"night.humidity_pct\": 83,\n \"night.rain.high_inches\": 2,\n \"night.rain.low_inches\": 1,\n \"night.rain.precip_pct\": 100,\n \"night.weather.description\": \"Thunderstorms/Wind\",\n \"night.weather.icon\": \"04d\",\n \"night.weather.summary\": \"Tropical storm conditions likely. Windy with bands of heavy rain showers and thunderstorms.\",\n \"night.wind.direction\": \"SSW\",\n \"night.wind.speed_ave_mph\": 71,\n \"night.wind.speed_low_mph\": 60,\n \"night.wind.speed_mph\": 80,\n \"sunrise\": \"07:04\",\n \"sunset\": \"19:30\",\n \"temp_f_max\": 85,\n \"temp_f_min\": 79\n },\n {\n \"date\": \"2017-11-09\",\n \"day.humidity_pct\": 72,\n \"day.rain.high_inches\": 2,\n \"day.rain.low_inches\": 1,\n \"day.rain.precip_pct\": 20,\n \"day.uv_index\": 9,\n \"day.weather.description\": \"Partly Cloudy/Wind\",\n \"day.weather.icon\": \"03d\",\n \"day.weather.summary\": \"Windy. Mostly cloudy skies will become partly cloudy in the afternoon.\",\n \"day.wind.direction\": \"WSW\",\n \"day.wind.speed_ave_mph\": 16,\n \"day.wind.speed_high_mph\": 20,\n \"day.wind.speed_low_mph\": 10,\n \"moonrise\": \"2339\",\n \"moonset\": \"1213\",\n \"night.humidity_pct\": 82,\n \"night.rain.high_inches\": null,\n \"night.rain.low_inches\": null,\n \"night.rain.precip_pct\": 10,\n \"night.weather.description\": \"Partly cloudy\",\n \"night.weather.icon\": \"04d\",\n \"night.weather.summary\": \"A few clouds.\",\n \"night.wind.direction\": \"WSW\",\n \"night.wind.speed_ave_mph\": 16,\n \"night.wind.speed_low_mph\": 10,\n \"night.wind.speed_mph\": 20,\n \"sunrise\": \"0705\",\n \"sunset\": \"1929\",\n \"temp_f_max\": 90,\n \"temp_f_min\": 77\n }\n ]\n }\n\n\nAuthors\n-------\n\n`jsonflatten` was written by `Tim Phillips `_.\n\nCredits\n-------\nBrian Peterson `bpeterso2000 `_, creator of JSON Transformations ``_\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/json-transformations/jsonflatten", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "jsonflatten", "package_url": "https://pypi.org/project/jsonflatten/", "platform": "", "project_url": "https://pypi.org/project/jsonflatten/", "project_urls": { "Homepage": "https://github.com/json-transformations/jsonflatten" }, "release_url": "https://pypi.org/project/jsonflatten/0.2/", "requires_dist": [ "jsoncut", "click (>=6.0)" ], "requires_python": "", "summary": "A JSON flattening and dataframe generation tool.", "version": "0.2" }, "last_serial": 3251594, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "68bec43caec9bf0e1079316838058b1d", "sha256": "7c3d4e17415cf79e5954ab2f85a5a9646d43df27d4d3cedaa1a60c5ae25a78db" }, "downloads": -1, "filename": "jsonflatten-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "68bec43caec9bf0e1079316838058b1d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10336, "upload_time": "2017-10-15T14:22:40", "url": "https://files.pythonhosted.org/packages/53/6a/1c53d924792e40617460935b4d7a1a094438c1f46aba9639dc9a6e0ceaee/jsonflatten-0.2-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "68bec43caec9bf0e1079316838058b1d", "sha256": "7c3d4e17415cf79e5954ab2f85a5a9646d43df27d4d3cedaa1a60c5ae25a78db" }, "downloads": -1, "filename": "jsonflatten-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "68bec43caec9bf0e1079316838058b1d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10336, "upload_time": "2017-10-15T14:22:40", "url": "https://files.pythonhosted.org/packages/53/6a/1c53d924792e40617460935b4d7a1a094438c1f46aba9639dc9a6e0ceaee/jsonflatten-0.2-py2.py3-none-any.whl" } ] }