{ "info": { "author": "Stavros Korokithakis", "author_email": "hi@stavros.io", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "JSane\n=====\n\n.. image:: https://travis-ci.org/skorokithakis/jsane.svg?branch=master\n :target: https://travis-ci.org/skorokithakis/jsane\n\nJSane is a JSON \"parser\" that makes attribute accesses easier.\n\nThree-line intro\n----------------\n\n::\n\n >>> import jsane\n >>> j = jsane.loads('{\"foo\": {\"bar\": {\"baz\": [\"well\", \"hello\", \"there\"]}}}')\n >>> j.foo.bar.baz[1].r()\n u'hello'\n\n\nMotivation\n----------\n\nPicture the scene. You're a jet-setting developer who is obsessed with going to\nthe gym. One day, a world-class jewel thief kidnaps you and asks you to hack\ninto the super-secure bank server in thirty seconds, while an ultramodel is\nperforming oral sex on you. You hurriedly trace the protocol on the wire, only\nto discover, to your dismay, that it uses JSON. Nested JSON, with levels and\nlevels of keys.\n\nIt's hopeless! You'll never type all those brackets and quotation marks in time!\nSuddenly, a flash of a memory races through your mind, like some cliche from\na badly-written README. You launch the shell and type two words::\n\n import jsane\n\n`The day is saved`_.\n\n\nMotivation (non-Hollywood version)\n----------------------------------\n\nAre you frustrated with having to traverse your nested JSON key by key?\n\n::\n\n root = my_json.get(\"root\")\n if root is None:\n return None\n\n key1 = root.get(\"key1\")\n if key1 is None:\n return None\n\n key2 = key1.get(\"key2\")\n if key2 is None:\n return None\n\n \n\nIs your code ruined by pesky all-catching ``except`` blocks?\n\n::\n\n try:\n my_json[\"root\"][\"key1\"][\"key2\"][\"key3\"]\n except:\n return None\n\nAre you tired of typing all the braces and quotes all the time?\n\n::\n\n my_json[\"root\"][\"key1\"[\"\"]][]\"]']'\"}}\"\"]\n\nNow there's JSane!\n\n\nMotivation (non-infomercial version)\n------------------------------------\n\nOkay seriously, ``this[\"thing\"][\"is\"][\"no\"][\"fun\"]``. JSane lets you\n``traverse.json.like.this.r()``. That's it.\n\n\nUsage\n-----\n\nUsing JSane is simple, at least. It's pretty much a copy of the builtin\n``json`` module.\n\nFirst of all, install it with ``pip`` or ``easy_install``::\n\n pip install jsane\n\nHere's an example of its usage::\n\n >>> import jsane\n\n >>> j = jsane.loads('{\"some\": {\"json\": [1, 2, 3]}}')\n >>> j.some.json[2].r()\n 3\n\nYou can also load an existing dictionary::\n >>> j = jsane.from_dict({\"hi\": \"there\"})\n >>> j.hi\n 'there'\n\nIf the dictionary contains any data types that aren't valid in JSON (like\nfunctions), it still should work, but you're on your own.\n\nDue to Python being a sensible language, there's a limit to the amount of\ncrap you can pull with it, so JSane actually returns a ``Traversable`` object on\naccesses::\n\n >>> j = jsane.loads('{\"foo\": {\"bar\": {\"baz\": \"yes!\"}}}')\n >>> type(j.foo)\n Traversable\n\nIf you want your real object back at the end of the wild attribute ride, call\n``.r()``::\n\n >>> j.foo.bar.r()\n {\"baz\": \"yes!\"}\n\nIf an attribute, item or index along the way does not exist, you'll get an\nexception. You can get rid of that by specifying a default::\n\n >>> import jsane\n\n >>> j = jsane.loads('{\"some\": \"json\"}')\n >>> j.haha_sucka_this_doesnt_exist.r(default=\"\ud83d\udca9\")\n \"\ud83d\udca9\"\n\n\"But how do I access a key called ``r``?!\", I hear you ask. Worry not, I got you\ncovered::\n\n >>> j.key[\"r\"].more_key.r()\n\nConfused? Don't name your keys ``r``, then.\n\nThat's about it. I'm not loving the ``r()`` API, so if anyone has any good\nrecommendations on how I may better fulfil my unholy purpose, I'm changing it on\nthe spot. No guarantees of stability before version 1, as always. Semver giveth,\nand semver taketh away.\n\nHelp needed/welcome/etc, mostly with designing the API. Also, if you find this\nlibrary useless, let me know.\n\n\nLicense\n-------\n\nBSD. Or MIT. Whatever's in the LICENSE file. I forget. It's permissive, though,\nso relax.\n\n\nSelf-promotion\n--------------\n\nIt's me, Stavros.\n\n\nFAQ\n---\n\n* Do you find it ironic that the README for JSane is insane?\n\n No.\n\n* Is this library awesome?\n\n Yes.\n\n* I hate the `.r()` thing, is there any way to avoid it?\n\n Did you even **read** this README?\n\n Alright, there is now a way to avoid it. Instead of ``j.foo.bar.r()``, you can\n just call the last key, i.e. ``j,foo.bar()``. Let me know what you think in\n `the relevant issue `_.\n\n.. _The day is saved: https://www.youtube.com/watch?v=mWqGJ613M5Y\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/skorokithakis/jsane/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "jsane", "package_url": "https://pypi.org/project/jsane/", "platform": "", "project_url": "https://pypi.org/project/jsane/", "project_urls": { "Homepage": "https://github.com/skorokithakis/jsane/" }, "release_url": "https://pypi.org/project/jsane/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "A saner way to parse JSON.", "version": "0.1.2" }, "last_serial": 3706978, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "d8b6167bcf4f7ddfc6f33d834b11e207", "sha256": "65a2acac07ed3f953d5d0a6c54314ea68f539314e0a28b9d7bd836173cb9862c" }, "downloads": -1, "filename": "jsane-0.0.1-py2.7.egg", "has_sig": false, "md5_digest": "d8b6167bcf4f7ddfc6f33d834b11e207", "packagetype": "bdist_egg", "python_version": "2.7", "requires_python": null, "size": 6172, "upload_time": "2016-03-09T13:21:12", "url": "https://files.pythonhosted.org/packages/9a/2d/8c17d6a4bf5dfc3bfade8f1b660602a4d4bc6d5ac1561fe17937d2c347ef/jsane-0.0.1-py2.7.egg" }, { "comment_text": "", "digests": { "md5": "dc0d65fa2a7de71dd4a73ed07f53e204", "sha256": "84804448fd934593c957e8a73a118c61b845fbb947fb6b6f7a8f3afa68479121" }, "downloads": -1, "filename": "jsane-0.0.1-py2-none-any.whl", "has_sig": false, "md5_digest": "dc0d65fa2a7de71dd4a73ed07f53e204", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 6833, "upload_time": "2016-01-29T01:38:46", "url": "https://files.pythonhosted.org/packages/96/eb/13e5e9d9aaa230287c7fdace8a5b46a07b0f9071df86e0b829fd8b5ed704/jsane-0.0.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0c9f1d29938abee6e48c479a9983840d", "sha256": "bc83e4ee784e1dc63c6f80298fe113f45b1daba7b66c47c0aae5e9150a2e31de" }, "downloads": -1, "filename": "jsane-0.0.1.tar.gz", "has_sig": false, "md5_digest": "0c9f1d29938abee6e48c479a9983840d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4101, "upload_time": "2016-01-29T01:38:27", "url": "https://files.pythonhosted.org/packages/de/d0/c4012c3e478afdf24f23b90ce46785ee7630cfd6d85086d49dc6ea894c1c/jsane-0.0.1.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "04adb12c5486b2a14f53d0493f16f2f5", "sha256": "fcf9744f1b84fa2dc0b9cf5b3d5dfb0bde5127a457e9687055a5577aad7e46e2" }, "downloads": -1, "filename": "jsane-0.1.0-py2-none-any.whl", "has_sig": false, "md5_digest": "04adb12c5486b2a14f53d0493f16f2f5", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7301, "upload_time": "2016-03-09T13:21:19", "url": "https://files.pythonhosted.org/packages/88/a4/8cdaabdde258358932138d736a684c3a1e615941766408096045032cbd2c/jsane-0.1.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5850ecdf32ebdfa0c62058afa5548aa", "sha256": "2e5f0f647f1edeeae81af29190d1a3a38c71ca4143b34f4a1dac9085e6851851" }, "downloads": -1, "filename": "jsane-0.1.0.tar.gz", "has_sig": false, "md5_digest": "f5850ecdf32ebdfa0c62058afa5548aa", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4418, "upload_time": "2016-03-09T13:20:59", "url": "https://files.pythonhosted.org/packages/6b/1b/5e16ab62fcd142d14c7d6544212c0ca71d0038d1a99d93844be9cfe52d2f/jsane-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "7387d4a43e97b3adfc799847c6b1c6c6", "sha256": "eca33311c09f6e223909b2ac055775f87d9cc803a348d0a4c63ece6bf53f8aa3" }, "downloads": -1, "filename": "jsane-0.1.1-py2-none-any.whl", "has_sig": false, "md5_digest": "7387d4a43e97b3adfc799847c6b1c6c6", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 7473, "upload_time": "2017-01-10T16:46:45", "url": "https://files.pythonhosted.org/packages/36/77/2ee2a25b61aec567cf5e71d584343992f2b27bc5401e36539ea810c13fd2/jsane-0.1.1-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6ec11eac96033d45945c64c24974a62d", "sha256": "ef89fa9d83f711ea780666b26a023e2c79e4cf3ce312c2cd2a6554d406fc7eb2" }, "downloads": -1, "filename": "jsane-0.1.1-py3.6.egg", "has_sig": false, "md5_digest": "6ec11eac96033d45945c64c24974a62d", "packagetype": "bdist_egg", "python_version": "3.6", "requires_python": null, "size": 6736, "upload_time": "2018-03-26T15:12:56", "url": "https://files.pythonhosted.org/packages/6b/ed/0f4fd81008a8e28600e9cd61191a059db3af0ed7c3a02fb5177878f72b29/jsane-0.1.1-py3.6.egg" }, { "comment_text": "", "digests": { "md5": "db11df8e49a50cc5150fcaef8bc81392", "sha256": "21dd7908b9f9797ce4baf2d79df43a298b2346be3788897684e7749107016ab8" }, "downloads": -1, "filename": "jsane-0.1.1.tar.gz", "has_sig": false, "md5_digest": "db11df8e49a50cc5150fcaef8bc81392", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4594, "upload_time": "2017-01-10T16:46:47", "url": "https://files.pythonhosted.org/packages/4c/64/72a16831504454ca345f80614c45ef4d3837d796baa2abab37b8cb282b7c/jsane-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "5d95938afd5c8bef62ff7a1c81e1e6d6", "sha256": "b9649598966f4825273d24ffe3f5957e410cae96086d6cc6e3227b3a63ff06cd" }, "downloads": -1, "filename": "jsane-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5d95938afd5c8bef62ff7a1c81e1e6d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7743, "upload_time": "2018-03-26T15:12:54", "url": "https://files.pythonhosted.org/packages/b3/96/3e29ac301a24f7f2cc46d024c76263a0a3ee1885bf7776c63d17b658a9eb/jsane-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5d0589b15a8918f553c742afa8dc366", "sha256": "fb1b4cf6c5590aa4c89b00810eb93878aae1bc780199b6fbba3e796fabc5c443" }, "downloads": -1, "filename": "jsane-0.1.2.tar.gz", "has_sig": false, "md5_digest": "f5d0589b15a8918f553c742afa8dc366", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4678, "upload_time": "2018-03-26T15:12:55", "url": "https://files.pythonhosted.org/packages/a2/f6/62770a87363bc1593b529b1738dab628586f47df0b7aa41d1d9b42aab0b8/jsane-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5d95938afd5c8bef62ff7a1c81e1e6d6", "sha256": "b9649598966f4825273d24ffe3f5957e410cae96086d6cc6e3227b3a63ff06cd" }, "downloads": -1, "filename": "jsane-0.1.2-py3-none-any.whl", "has_sig": false, "md5_digest": "5d95938afd5c8bef62ff7a1c81e1e6d6", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7743, "upload_time": "2018-03-26T15:12:54", "url": "https://files.pythonhosted.org/packages/b3/96/3e29ac301a24f7f2cc46d024c76263a0a3ee1885bf7776c63d17b658a9eb/jsane-0.1.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f5d0589b15a8918f553c742afa8dc366", "sha256": "fb1b4cf6c5590aa4c89b00810eb93878aae1bc780199b6fbba3e796fabc5c443" }, "downloads": -1, "filename": "jsane-0.1.2.tar.gz", "has_sig": false, "md5_digest": "f5d0589b15a8918f553c742afa8dc366", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4678, "upload_time": "2018-03-26T15:12:55", "url": "https://files.pythonhosted.org/packages/a2/f6/62770a87363bc1593b529b1738dab628586f47df0b7aa41d1d9b42aab0b8/jsane-0.1.2.tar.gz" } ] }