jsoup


Namejsoup JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/MrDebugger/jsoup
SummaryConvert JSON to BeautifulSoup object
upload_time2023-01-30 20:57:25
maintainer
docs_urlNone
authorIjaz Ur Rahim
requires_python>=3.6
licenseMIT
keywords parser html bs4 beautifulsoup soup jsoup json builder
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPi version](https://img.shields.io/pypi/v/jsoup.svg)](https://pypi.python.org/pypi/jsoup/)
[![PyPi pyversions](https://img.shields.io/pypi/pyversions/jsoup.svg)](https://pypi.python.org/pypi/jsoup/)
[![PyPi license](https://img.shields.io/pypi/l/jsoup.svg)](https://pypi.python.org/pypi/jsoup/)

# Jsoup

Jsoup is a python library that helps to parse and build HTML/XML structures using JSON format.

Installation
----

Use the package manager pip to install jsoup.


```
pip install jsoup

```


Usage
----

```python
from jsoup import JsonTreeBuilder
from bs4 import BeautifulSoup

json = {
        "body": {
            "h1": {"attrs":{"class":"heading1"}, "text":"Hello World"},
            "p": ["this ", "is ", "a ","test 1<2 && 2>1", {"comment":["this is a comment"]}],
            "comment": "this is also a comment",
            "br": None,
            "form" : {
                "attrs": {
                    "method": "post"
                },
                "input": {"attrs":{
                    "type": "text",
                    "name": "username"
                }}
            }
        }
}

soup = BeautifulSoup(json, builder=JsonTreeBuilder)
print(soup.prettify())
```

Output
----

```html
<body>
 <h1 class="heading1">
  Hello World
 </h1>
 <p>
  this
 </p>
 <p>
  is
 </p>
 <p>
  a
 </p>
 <p>
  test 1&lt;2 &amp;&amp; 2&gt;1
 </p>
 <p>
  <!--this is a comment-->
 </p>
 <!--this is also a comment-->
 <br/>
 <form method="post">
  <input name="username" type="text"/>
 </form>
</body>
```



Contributing
----

We welcome contributions to `jsoup`. To get started, follow these steps:

1. Fork the repository and clone it to your local machine.
2. Create a new branch for your changes.
3. Make your changes and write tests to cover them.
4. Ensure all tests pass by running `python -m unittest discover -v`.
5. Push your changes to your fork and create a pull request.

We appreciate all contributions and thank all the contributors!

<a href = "https://github.com/MrDebugger/jsoup/graphs/contributors">
  <img src = "https://contrib.rocks/image?repo=MrDebugger/jsoup"/>
</a>



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MrDebugger/jsoup",
    "name": "jsoup",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "parser,html,bs4,BeautifulSoup,soup,jsoup,json,builder",
    "author": "Ijaz Ur Rahim",
    "author_email": "ijazkhan095@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/06/5d/7e1e8b18128b6c6ebb7633a15f0fed47d71dd2b12b7c0ac4542dec071bb4/jsoup-0.0.1.tar.gz",
    "platform": null,
    "description": "[![PyPi version](https://img.shields.io/pypi/v/jsoup.svg)](https://pypi.python.org/pypi/jsoup/)\n[![PyPi pyversions](https://img.shields.io/pypi/pyversions/jsoup.svg)](https://pypi.python.org/pypi/jsoup/)\n[![PyPi license](https://img.shields.io/pypi/l/jsoup.svg)](https://pypi.python.org/pypi/jsoup/)\n\n# Jsoup\n\nJsoup is a python library that helps to parse and build HTML/XML structures using JSON format.\n\nInstallation\n----\n\nUse the package manager pip to install jsoup.\n\n\n```\npip install jsoup\n\n```\n\n\nUsage\n----\n\n```python\nfrom jsoup import JsonTreeBuilder\nfrom bs4 import BeautifulSoup\n\njson = {\n        \"body\": {\n            \"h1\": {\"attrs\":{\"class\":\"heading1\"}, \"text\":\"Hello World\"},\n            \"p\": [\"this \", \"is \", \"a \",\"test 1<2 && 2>1\", {\"comment\":[\"this is a comment\"]}],\n            \"comment\": \"this is also a comment\",\n            \"br\": None,\n            \"form\" : {\n                \"attrs\": {\n                    \"method\": \"post\"\n                },\n                \"input\": {\"attrs\":{\n                    \"type\": \"text\",\n                    \"name\": \"username\"\n                }}\n            }\n        }\n}\n\nsoup = BeautifulSoup(json, builder=JsonTreeBuilder)\nprint(soup.prettify())\n```\n\nOutput\n----\n\n```html\n<body>\n <h1 class=\"heading1\">\n  Hello World\n </h1>\n <p>\n  this\n </p>\n <p>\n  is\n </p>\n <p>\n  a\n </p>\n <p>\n  test 1&lt;2 &amp;&amp; 2&gt;1\n </p>\n <p>\n  <!--this is a comment-->\n </p>\n <!--this is also a comment-->\n <br/>\n <form method=\"post\">\n  <input name=\"username\" type=\"text\"/>\n </form>\n</body>\n```\n\n\n\nContributing\n----\n\nWe welcome contributions to `jsoup`. To get started, follow these steps:\n\n1. Fork the repository and clone it to your local machine.\n2. Create a new branch for your changes.\n3. Make your changes and write tests to cover them.\n4. Ensure all tests pass by running `python -m unittest discover -v`.\n5. Push your changes to your fork and create a pull request.\n\nWe appreciate all contributions and thank all the contributors!\n\n<a href = \"https://github.com/MrDebugger/jsoup/graphs/contributors\">\n  <img src = \"https://contrib.rocks/image?repo=MrDebugger/jsoup\"/>\n</a>\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Convert JSON to BeautifulSoup object",
    "version": "0.0.1",
    "split_keywords": [
        "parser",
        "html",
        "bs4",
        "beautifulsoup",
        "soup",
        "jsoup",
        "json",
        "builder"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a891016e5cb414583a44e6f5786b6f0f5d6c93b0e6fb0f51ca3e324c9337954f",
                "md5": "ec7929a1fd8b9d6264726dd7a6a75b9f",
                "sha256": "e0d2b77da0ee7a58a0cf3a9c2f2c50efea3d6d64d0baaa28fb26523b82c6ec4d"
            },
            "downloads": -1,
            "filename": "jsoup-0.0.1-py3.8.egg",
            "has_sig": false,
            "md5_digest": "ec7929a1fd8b9d6264726dd7a6a75b9f",
            "packagetype": "bdist_egg",
            "python_version": "0.0.1",
            "requires_python": ">=3.6",
            "size": 6798,
            "upload_time": "2023-01-30T20:57:23",
            "upload_time_iso_8601": "2023-01-30T20:57:23.434884Z",
            "url": "https://files.pythonhosted.org/packages/a8/91/016e5cb414583a44e6f5786b6f0f5d6c93b0e6fb0f51ca3e324c9337954f/jsoup-0.0.1-py3.8.egg",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0cd4b944a8d5ce404272da35c5909f9252a9452befa35b2336be473ac7c28ebb",
                "md5": "6070564c931282c5ec414570af667853",
                "sha256": "ad496a2412da0ec03cc70a1719f1dbb7bbc3665f0499c6ae9ee364a3a3e02139"
            },
            "downloads": -1,
            "filename": "jsoup-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6070564c931282c5ec414570af667853",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 4829,
            "upload_time": "2023-01-30T20:57:21",
            "upload_time_iso_8601": "2023-01-30T20:57:21.247885Z",
            "url": "https://files.pythonhosted.org/packages/0c/d4/b944a8d5ce404272da35c5909f9252a9452befa35b2336be473ac7c28ebb/jsoup-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "065d7e1e8b18128b6c6ebb7633a15f0fed47d71dd2b12b7c0ac4542dec071bb4",
                "md5": "12f2dbef388b2ad308b990eedb451f92",
                "sha256": "0a0208f03d160d72dbda903c343eeeb7e10535a245b48bbf9c92c84617027ee3"
            },
            "downloads": -1,
            "filename": "jsoup-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "12f2dbef388b2ad308b990eedb451f92",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4228,
            "upload_time": "2023-01-30T20:57:25",
            "upload_time_iso_8601": "2023-01-30T20:57:25.361657Z",
            "url": "https://files.pythonhosted.org/packages/06/5d/7e1e8b18128b6c6ebb7633a15f0fed47d71dd2b12b7c0ac4542dec071bb4/jsoup-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-30 20:57:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "MrDebugger",
    "github_project": "jsoup",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "jsoup"
}
        
Elapsed time: 0.08558s