{ "info": { "author": "Sebastian Rittau", "author_email": "srittau@rittau.biz", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development" ], "description": "Python JSON Get\n===============\n\n.. image:: https://img.shields.io/pypi/l/json-get.svg\n :target: https://pypi.python.org/pypi/json-get/\n.. image:: https://img.shields.io/github/release/srittau/python-json-get/all.svg\n :target: https://github.com/srittau/python-json-get/releases/\n.. image:: https://img.shields.io/pypi/v/json-get.svg\n :target: https://pypi.python.org/pypi/json-get/\n.. image:: https://travis-ci.org/srittau/python-json-get.svg?branch=master\n :target: https://travis-ci.org/srittau/python-json-get\n\nGet values from JSON objects usings a path expression. Optional type\nchecking is possible:\n\n>>> from jsonget import json_get, json_get_default, JList\n>>> j = {\n... \"foo\": {\"num\": 3.4, \"s\": \"Text\"},\n... \"arr\": [10, 20, 30],\n... }\n>>> json_get(j, \"/foo/num\")\n3.4\n>>> json_get(j, \"/arr[1]\")\n20\n>>> json_get(j, \"/foo/unknown\")\nTraceback (most recent call last):\n ...\nValueError: JSON path '/foo/unknown' not found\n\nValues are optionally checked against one of the following types:\n``str``, ``int``, ``float``, ``bool``, ``list``, and ``dict``.\nChecking for null values is not supported:\n\n>>> json_get(j, \"/foo/num\", str)\nTraceback (most recent call last):\n ...\nTypeError: wrong JSON type str != float\n\n``float`` will match any number, ``int`` will only match numbers without\na fractional part:\n\n>>> json_get(j, \"/foo/num\", float)\n3.4\n>>> json_get(j, \"/foo/num\", int)\nTraceback (most recent call last):\n ...\nTypeError: wrong JSON type int != float\n\nAdditionally, the type of list values can be checked:\n\n>>> json_get(j, \"/arr\", JList(int))\n[10, 20, 30]\n\n``json_get_default()`` can be used to return a default value if a given\npath does not exist:\n\n>>> json_get_default(j, \"/bar\", \"default value\")\n'default value'\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/srittau/python-json-get", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "json-get", "package_url": "https://pypi.org/project/json-get/", "platform": "", "project_url": "https://pypi.org/project/json-get/", "project_urls": { "Homepage": "https://github.com/srittau/python-json-get" }, "release_url": "https://pypi.org/project/json-get/1.1.1/", "requires_dist": null, "requires_python": ">=3.5", "summary": "Get values from JSON objects using a path expression", "version": "1.1.1" }, "last_serial": 3905580, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "01dd2bdfbca5246dcc7a5002853a30ad", "sha256": "3512b625808233eee3cf1b5fa10500f03719ff844d656bdec240c22c24c07d84" }, "downloads": -1, "filename": "json-get-1.0.tar.gz", "has_sig": false, "md5_digest": "01dd2bdfbca5246dcc7a5002853a30ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3265, "upload_time": "2017-03-19T22:12:38", "url": "https://files.pythonhosted.org/packages/d3/26/5c92568634f2f639679f9b12ce81eff0f7216b5b02c1faad6ddb7ab5d03c/json-get-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "b3b6ee3d0abbe4e0d2551bb159b95026", "sha256": "621616e0ed34d1205f2b658915c413d87cfb08917cc2796e7b2677499db3161d" }, "downloads": -1, "filename": "json_get-1.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "b3b6ee3d0abbe4e0d2551bb159b95026", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6720, "upload_time": "2017-10-26T23:09:43", "url": "https://files.pythonhosted.org/packages/46/b3/7bb5d7c0954be671a3f372acba0329601f65c060b99d059f4713a5c3b0c0/json_get-1.0.1-py3-none-any.whl" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "b42a288984793c7935ba3d0d42239bfc", "sha256": "098c2dbbc4ed24f9f0238025587b8b6d067c6ce0b01e754bd2e4180e29d5a044" }, "downloads": -1, "filename": "json_get-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "b42a288984793c7935ba3d0d42239bfc", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6236, "upload_time": "2018-05-23T17:37:39", "url": "https://files.pythonhosted.org/packages/7b/d1/f293a7352d1f71e320511955d1a1c62f86f2c334135fa74c71c3944970fa/json_get-1.1.0-py3-none-any.whl" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "dd28c7aef2c6e6d12d454389f6ffc064", "sha256": "884854fb225aa72e2a975dc545704f93e1f87f9377108c27fa27b0c0cca92374" }, "downloads": -1, "filename": "json_get-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dd28c7aef2c6e6d12d454389f6ffc064", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6506, "upload_time": "2018-05-28T12:35:41", "url": "https://files.pythonhosted.org/packages/fe/f6/a8fe09ed8b3db17ceb41ae21e54923256402c3fca90d8874fe9216721ae9/json_get-1.1.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd28c7aef2c6e6d12d454389f6ffc064", "sha256": "884854fb225aa72e2a975dc545704f93e1f87f9377108c27fa27b0c0cca92374" }, "downloads": -1, "filename": "json_get-1.1.1-py3-none-any.whl", "has_sig": false, "md5_digest": "dd28c7aef2c6e6d12d454389f6ffc064", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.5", "size": 6506, "upload_time": "2018-05-28T12:35:41", "url": "https://files.pythonhosted.org/packages/fe/f6/a8fe09ed8b3db17ceb41ae21e54923256402c3fca90d8874fe9216721ae9/json_get-1.1.1-py3-none-any.whl" } ] }