# AsyncJ
**AsyncJ - Python module for fast asynchronous work with JSON files**
# Examples
**Get a dictionary from a JSON file**
```py
# Importing modules
import asyncio # To run the asynchronous main() function
from asyncj import AsyncJson # Main class used in the example
# Initialize the class with filename
asyncjson: AsyncJson = AsyncJson("test.json")
# The asynchronous main() function
async def main() -> None:
# Getting a dictionary
data: dict = await asyncjson.read()
# Displaying the resulting dictionary
print(data)
# Running the asynchronous main() function
if __name__ == "__main__":
asyncio.run(main())
```
**Change dictionary in JSON file**
```py
# Importing modules
import asyncio # To run the asynchronous main() function
from asyncj import AsyncJson # Main class used in the example
from random import randint # To generate a random number
# Initialize the class with filename
asyncjson: AsyncJson = AsyncJson("test.json")
# The asynchronous main() function
async def main() -> None:
# Getting a dictionary
data: dict = await asyncjson.read()
# Getting a random number
random_number: int = randint(100, 999)
# Setting a new random value in the dictionary for the "test" key
data["test"] = random_number
# Writing the modified dictionary to a JSON file
await asyncjson.write(data)
# Running the asynchronous main() function
if __name__ == "__main__":
asyncio.run(main())
```
# Requirements
**Python version 3.8 or higher**
Raw data
{
"_id": null,
"home_page": "https://github.com/VengDevs/AsyncJ",
"name": "asyncj",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "async json",
"author": "VengDevs",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/77/b3/50d5400e94641a61812393e4e9a9bfab4ee4e12bb36d49159b9953c8e685/asyncj-1.1.4.tar.gz",
"platform": null,
"description": "# AsyncJ\r\n**AsyncJ - Python module for fast asynchronous work with JSON files**\r\n\r\n# Examples\r\n**Get a dictionary from a JSON file**\r\n\r\n```py\r\n# Importing modules\r\nimport asyncio # To run the asynchronous main() function\r\n\r\nfrom asyncj import AsyncJson # Main class used in the example\r\n\r\n# Initialize the class with filename\r\nasyncjson: AsyncJson = AsyncJson(\"test.json\")\r\n\r\n\r\n# The asynchronous main() function\r\nasync def main() -> None:\r\n # Getting a dictionary\r\n data: dict = await asyncjson.read()\r\n # Displaying the resulting dictionary\r\n print(data)\r\n\r\n\r\n# Running the asynchronous main() function\r\nif __name__ == \"__main__\": \r\n asyncio.run(main())\r\n```\r\n\r\n**Change dictionary in JSON file**\r\n```py\r\n# Importing modules\r\nimport asyncio # To run the asynchronous main() function\r\n\r\nfrom asyncj import AsyncJson # Main class used in the example\r\n\r\nfrom random import randint # To generate a random number\r\n\r\n# Initialize the class with filename\r\nasyncjson: AsyncJson = AsyncJson(\"test.json\")\r\n\r\n\r\n# The asynchronous main() function\r\nasync def main() -> None:\r\n # Getting a dictionary\r\n data: dict = await asyncjson.read()\r\n # Getting a random number\r\n random_number: int = randint(100, 999)\r\n # Setting a new random value in the dictionary for the \"test\" key\r\n data[\"test\"] = random_number\r\n # Writing the modified dictionary to a JSON file\r\n await asyncjson.write(data)\r\n\t\r\n\r\n# Running the asynchronous main() function\r\nif __name__ == \"__main__\": \r\n asyncio.run(main())\r\n```\r\n\r\n# Requirements\r\n**Python version 3.8 or higher**\r\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Python module for fast asynchronous work with JSON files",
"version": "1.1.4",
"project_urls": {
"Homepage": "https://github.com/VengDevs/AsyncJ"
},
"split_keywords": [
"async",
"json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ae54781ef5a7a6259e6b95228fe06e2c78be5f334514b297cd06331efdb18d61",
"md5": "3a234034f621b8c8e7b50a4d59d9b0b7",
"sha256": "4d38d5812f51811a6ca15d94df74cfd36a9ffb94a2e53a39cec3640c995ea944"
},
"downloads": -1,
"filename": "asyncj-1.1.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3a234034f621b8c8e7b50a4d59d9b0b7",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4257,
"upload_time": "2024-03-06T15:23:47",
"upload_time_iso_8601": "2024-03-06T15:23:47.292645Z",
"url": "https://files.pythonhosted.org/packages/ae/54/781ef5a7a6259e6b95228fe06e2c78be5f334514b297cd06331efdb18d61/asyncj-1.1.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77b350d5400e94641a61812393e4e9a9bfab4ee4e12bb36d49159b9953c8e685",
"md5": "0571fdb619c9d9a2288ecace42c308c7",
"sha256": "dc9f893b77de5a19b044986f24d8574cc71f1907ff6e5ed8ad61468f672250a2"
},
"downloads": -1,
"filename": "asyncj-1.1.4.tar.gz",
"has_sig": false,
"md5_digest": "0571fdb619c9d9a2288ecace42c308c7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3223,
"upload_time": "2024-03-06T15:23:48",
"upload_time_iso_8601": "2024-03-06T15:23:48.523544Z",
"url": "https://files.pythonhosted.org/packages/77/b3/50d5400e94641a61812393e4e9a9bfab4ee4e12bb36d49159b9953c8e685/asyncj-1.1.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-06 15:23:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "VengDevs",
"github_project": "AsyncJ",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "asyncj"
}