# URLDecoder
[English](./README.md) | [简体中文](./README_ZH.md)
## Introduction
URLDecoder is a simple yet effective Python library designed to decode URL-encoded strings and convert them into JSON objects. This tool aims to streamline the process of transforming complex URL-encoded strings into a more human-readable and manageable format. With its easy-to-use functionality, URLDecoder can be a valuable addition to any project that requires processing and understanding URL-encoded data. Whether you are working with APIs, web scraping, or data analysis tasks, URLDecoder can help you efficiently decode and interpret URL parameters in a structured way.
## Installation
URLDecoder can be installed using pip:
```bash
pip install urldecoder
```
## Usage
URLDecoder can be used to decode URL-encoded strings and convert them into JSON objects. The following example demonstrates how to use URLDecoder to decode a URL-encoded string:
```python
# pip install urldecoder
from URLDecoder.decoder import URLDecoder
# Example URL-encoded string
# url_encoded_string = input("Enter the URL-encoded string:")
url_encoded_string = "name%3DAdam%20Tan%26age%3D99%26city%3DSan%20Jose%26cat_name%3DBurger%26hobbies%3D%7B%22most_do%22%3A%20%22programming%22%2C%20%22less_do%22%3A%20%22play_skateboard%22%2C%20%22others%22%3A%20%5B%22pool%22%2C%20%22pogo%22%2C%20%22airsoft%22%5D%7D%26job%3Dengineer"
# Initialize the URLDecoder class
decoder = URLDecoder()
# Decode the URL-encoded string and convert it to a dictionary object
dict_object = decoder.to_dict(url_encoded_string)
print('dict_object:', dict_object)
# Convert the dictionary object to a JSON object
json_object = decoder.to_json(url_encoded_string)
print(json_object)
# Convert the JSON object to a URL-encoded string
encoded_url = URLDecoder.to_url(json_object)
print('encoded_url:', encoded_url)
```
The output of the above code is:
```dict
dict_object: {'name': 'Adam Tan', 'age': 25, 'city': 'San Jose', 'cat_name': 'Burger', 'hobbies': {'most_do': 'programming', 'less_do': 'play_skateboard', 'others': ['pool', 'pogo', 'airsoft']}, 'job': 'engineer'}
```
```json
{
"name": "Adam Tan",
"age": 25,
"city": "San Jose",
"cat_name": "Burger",
"hobbies": {
"most_do": "programming",
"less_do": "play_skateboard",
"others": [
"pool",
"pogo",
"airsoft"
]
},
"job": "engineer"
}
```
```url
encoded_url: name=Adam%20Tan&age=25&city=San%20Jose&cat_name=Burger&hobbies=%7B%27most_do%27%3A%20%27programming%27%2C%20%27less_do%27%3A%20%27play_skateboard%27%2C%20%27others%27%3A%20%5B%27pool%27%2C%20%27pogo%27%2C%20%27airsoft%27%5D%7D&job=engineer
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
## License
URLDecoder is licensed under the MIT License. See [LICENSE](LICENSE) for more information.
Raw data
{
"_id": null,
"home_page": "https://github.com/Evil0ctal/URLDecoder",
"name": "URLDecoder",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "encoded url decoder json",
"author": "Evil0ctal",
"author_email": "evil0ctal1985@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/1f/7b/43e255cba908b6b34cf5381db8ec08b9e376b66af25c36b58a3ea08e2e71/URLDecoder-1.0.3.tar.gz",
"platform": null,
"description": "# URLDecoder\r\n\r\n[English](./README.md) | [\u7b80\u4f53\u4e2d\u6587](./README_ZH.md)\r\n\r\n## Introduction\r\n\r\nURLDecoder is a simple yet effective Python library designed to decode URL-encoded strings and convert them into JSON objects. This tool aims to streamline the process of transforming complex URL-encoded strings into a more human-readable and manageable format. With its easy-to-use functionality, URLDecoder can be a valuable addition to any project that requires processing and understanding URL-encoded data. Whether you are working with APIs, web scraping, or data analysis tasks, URLDecoder can help you efficiently decode and interpret URL parameters in a structured way.\r\n\r\n## Installation\r\n\r\nURLDecoder can be installed using pip:\r\n\r\n```bash\r\npip install urldecoder\r\n```\r\n\r\n## Usage\r\n\r\nURLDecoder can be used to decode URL-encoded strings and convert them into JSON objects. The following example demonstrates how to use URLDecoder to decode a URL-encoded string:\r\n\r\n```python\r\n# pip install urldecoder\r\nfrom URLDecoder.decoder import URLDecoder\r\n\r\n# Example URL-encoded string\r\n# url_encoded_string = input(\"Enter the URL-encoded string:\")\r\nurl_encoded_string = \"name%3DAdam%20Tan%26age%3D99%26city%3DSan%20Jose%26cat_name%3DBurger%26hobbies%3D%7B%22most_do%22%3A%20%22programming%22%2C%20%22less_do%22%3A%20%22play_skateboard%22%2C%20%22others%22%3A%20%5B%22pool%22%2C%20%22pogo%22%2C%20%22airsoft%22%5D%7D%26job%3Dengineer\"\r\n\r\n# Initialize the URLDecoder class\r\ndecoder = URLDecoder()\r\n\r\n# Decode the URL-encoded string and convert it to a dictionary object\r\ndict_object = decoder.to_dict(url_encoded_string)\r\nprint('dict_object:', dict_object)\r\n\r\n# Convert the dictionary object to a JSON object\r\njson_object = decoder.to_json(url_encoded_string)\r\nprint(json_object)\r\n\r\n# Convert the JSON object to a URL-encoded string\r\nencoded_url = URLDecoder.to_url(json_object)\r\nprint('encoded_url:', encoded_url)\r\n```\r\n\r\nThe output of the above code is:\r\n\r\n```dict\r\ndict_object: {'name': 'Adam Tan', 'age': 25, 'city': 'San Jose', 'cat_name': 'Burger', 'hobbies': {'most_do': 'programming', 'less_do': 'play_skateboard', 'others': ['pool', 'pogo', 'airsoft']}, 'job': 'engineer'}\r\n```\r\n\r\n```json\r\n{\r\n \"name\": \"Adam Tan\",\r\n \"age\": 25,\r\n \"city\": \"San Jose\",\r\n \"cat_name\": \"Burger\",\r\n \"hobbies\": {\r\n \"most_do\": \"programming\",\r\n \"less_do\": \"play_skateboard\",\r\n \"others\": [\r\n \"pool\",\r\n \"pogo\",\r\n \"airsoft\"\r\n ]\r\n },\r\n \"job\": \"engineer\"\r\n}\r\n```\r\n\r\n```url\r\nencoded_url: name=Adam%20Tan&age=25&city=San%20Jose&cat_name=Burger&hobbies=%7B%27most_do%27%3A%20%27programming%27%2C%20%27less_do%27%3A%20%27play_skateboard%27%2C%20%27others%27%3A%20%5B%27pool%27%2C%20%27pogo%27%2C%20%27airsoft%27%5D%7D&job=engineer\r\n```\r\n\r\n## Contributing\r\n\r\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\r\n\r\nPlease make sure to update tests as appropriate.\r\n\r\n## License\r\n\r\nURLDecoder is licensed under the MIT License. See [LICENSE](LICENSE) for more information.\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple URL decoder that converts URL-encoded strings to JSON objects",
"version": "1.0.3",
"split_keywords": [
"encoded",
"url",
"decoder",
"json"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2498d2ad4eaa6a886f8264b9f34b30d19f620b8cb5c87ec099e68ec03c18862f",
"md5": "75760ff3e0e8b949d3eae497b72410a3",
"sha256": "78fd346aaa94c5cf20d5de2a58041156e2476d2b792c06277b18be888987e718"
},
"downloads": -1,
"filename": "URLDecoder-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "75760ff3e0e8b949d3eae497b72410a3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4928,
"upload_time": "2023-03-18T01:51:47",
"upload_time_iso_8601": "2023-03-18T01:51:47.751122Z",
"url": "https://files.pythonhosted.org/packages/24/98/d2ad4eaa6a886f8264b9f34b30d19f620b8cb5c87ec099e68ec03c18862f/URLDecoder-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "1f7b43e255cba908b6b34cf5381db8ec08b9e376b66af25c36b58a3ea08e2e71",
"md5": "da4a98dfa83fe75935fafee93f3aa6e5",
"sha256": "21b09f1a5123be2ab9c01a84398c6b21833639a1c14ed17910d05f81ac3874ca"
},
"downloads": -1,
"filename": "URLDecoder-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "da4a98dfa83fe75935fafee93f3aa6e5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3925,
"upload_time": "2023-03-18T01:51:50",
"upload_time_iso_8601": "2023-03-18T01:51:50.055524Z",
"url": "https://files.pythonhosted.org/packages/1f/7b/43e255cba908b6b34cf5381db8ec08b9e376b66af25c36b58a3ea08e2e71/URLDecoder-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-03-18 01:51:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Evil0ctal",
"github_project": "URLDecoder",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "urldecoder"
}