{
"info": {
"author": "ccppoo",
"author_email": "shmishmi79@gmail.com",
"bugtrack_url": null,
"classifiers": [
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3"
],
"description": "# Lovely Json\n\n## Features\n\n ### 1. Direct Access to Key Value
\n**take a look at [example](https://github.com/ccppoo/lovely_json/blob/master/lovely_json_use_example.py) to run in code **
\n**This example uses \"[sample_api.json](https://github.com/ccppoo/lovely_json/blob/master/sample_api.json)\" so does the following examples\"**
\n\n#### 1-(1). load json\n```py\njson_data = open(\"./sample_api.json\", encoding=\"utf-8\", mode='r')\n\nj_sample = Lovely_Json(json.load(json_data), name = 'api_response')\t\n```\nYou need to load json file as you did before in this case too
\nIt was intentionaly designed like this to use at \".json\" file and
\nfor json response for servers\n\nIn case of using serval jsons, names are recommanded\n\n#### 1-(2). use dot operators to directly get key values\n**To get data by key**\n```py\n# Lovely_Json :\nprint(j_sample.Depth4.depth4_item1) # prints \"Python\"\n\n# Just Json :\noriginal = json.load(open(\"./sample_api.json\", encoding=\"utf-8\", mode='r'))\noriginal[\"Depth1\"][\"Depth2\"][\"Depth3\"][\"Depth4\"][\"depth4_item1\"] # prints \"Python\"\n```\n\nTo get data, you only need to know the key in the way to make sure what you are finding for. Take a look at image I made To show sample_api.json as graphs
\nImage.PNG)\n\nTo get Value That are dict, You could directly get it by dot operators (__getattr__)
\n```py\nprint(j_sample.Depth4) # prints {\"depth4_item1\" : \"Python\",\"depth4_item2\" : \"Haskell\"}\n```\n\n**But** If you want to get Value that isn't dict, You should go through upper key and then get it by dot operators\n```py\nprint(j_sample.Depth4.depth4_item1) # prints \"Python\"\n```\n\nYou could also do by this\n```py\nprint(j_sample.Depth1.depth4_item1) # prints \"Python\"\nprint(j_sample.Depth2.depth4_item1) # prints \"Python\"\nprint(j_sample.Depth3.depth4_item1) # prints \"Python\"\nprint(j_sample.Depth4.depth4_item1) # prints \"Python\"\n```\n\n ### 2. Access to List of Key Value
\n```py\n# to access item in list, returns list of value of key, \"id\"\nprint(j_sample.in_list(key = 'data').id , end='\\n\\n')\n# ---> prints [111, 222, -333]\n```\n```py\n# and if you have conditions about 'id'\nprint(j_sample.in_list(key = 'data', if_ ='id', is_ = (lambda x:x>0)).id , end='\\n\\n') \n# --->prints [111, 222]\n```\n```py\n# also you could use other key's value of conditions\nprint(j_sample.in_list(key = 'data', if_ ='type', is_ = (lambda x:x =='articles')).id, end='\\n\\n')\n# --->prints [111, -333]\n```\n\n\"if_\" and \"is_\" were desinged to be used like SQL Where syntex,\n*if_* takes key, wher you want to make conditions\n*is_* takes lamda or method that returns Bool ( True, False) to check the value fit in what you required\n\n\n## add\n\nlovely_json was made to make ease access of json data, when developing systems or services.
\nThere will be continuous update for useful methods and speed improvements,
\nBut using conventional ways will make much more speed improvements.
\n\nSo Think lovely_json as a tool when you use before releasing, like a rough sketch
\n\nThank You!\n\n\n",
"description_content_type": "text/markdown",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/ccppoo/lovely_json",
"keywords": "",
"license": "",
"maintainer": "",
"maintainer_email": "",
"name": "lovely-json",
"package_url": "https://pypi.org/project/lovely-json/",
"platform": "",
"project_url": "https://pypi.org/project/lovely-json/",
"project_urls": {
"Homepage": "https://github.com/ccppoo/lovely_json"
},
"release_url": "https://pypi.org/project/lovely-json/0.0.1/",
"requires_dist": null,
"requires_python": ">=3.6",
"summary": "Make Your Json Lovely",
"version": "0.0.1"
},
"last_serial": 5763854,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "9754887469b9930f5bcc22690f960fa8",
"sha256": "5e9276e26a17a88ffdcc572be0f9280bb1eeddb9132ecc24b3d3fa6b1b92f81c"
},
"downloads": -1,
"filename": "lovely_json-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9754887469b9930f5bcc22690f960fa8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3262,
"upload_time": "2019-08-31T08:28:11",
"url": "https://files.pythonhosted.org/packages/19/84/5c2be0af73b8ed36e06edc79178f46f033d1a9749f1448bc54e4214df000/lovely_json-0.0.1-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "cff9da25b3da1a0be38d85a93765194a",
"sha256": "b78cc5af704bd8ef6e0a93138df55145c994bf5ea7dedcf383b71af134a51db4"
},
"downloads": -1,
"filename": "lovely_json-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "cff9da25b3da1a0be38d85a93765194a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2527,
"upload_time": "2019-08-31T08:28:14",
"url": "https://files.pythonhosted.org/packages/f6/9e/440668d4873bf79a2331ecc0e99162fdd0e45d33842fb8ac1e8b99ac0bd6/lovely_json-0.0.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "9754887469b9930f5bcc22690f960fa8",
"sha256": "5e9276e26a17a88ffdcc572be0f9280bb1eeddb9132ecc24b3d3fa6b1b92f81c"
},
"downloads": -1,
"filename": "lovely_json-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "9754887469b9930f5bcc22690f960fa8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 3262,
"upload_time": "2019-08-31T08:28:11",
"url": "https://files.pythonhosted.org/packages/19/84/5c2be0af73b8ed36e06edc79178f46f033d1a9749f1448bc54e4214df000/lovely_json-0.0.1-py3-none-any.whl"
},
{
"comment_text": "",
"digests": {
"md5": "cff9da25b3da1a0be38d85a93765194a",
"sha256": "b78cc5af704bd8ef6e0a93138df55145c994bf5ea7dedcf383b71af134a51db4"
},
"downloads": -1,
"filename": "lovely_json-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "cff9da25b3da1a0be38d85a93765194a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 2527,
"upload_time": "2019-08-31T08:28:14",
"url": "https://files.pythonhosted.org/packages/f6/9e/440668d4873bf79a2331ecc0e99162fdd0e45d33842fb8ac1e8b99ac0bd6/lovely_json-0.0.1.tar.gz"
}
]
}