jsoneditor


Namejsoneditor JSON
Version 1.6.0 PyPI version JSON
download
home_pagehttps://github.com/dermasmid/py-jsoneditor
SummaryVisualize and edit JSON
upload_time2023-06-19 19:29:32
maintainer
docs_urlNone
authorCheskel Twersky
requires_python>=3.6
licenseMIT
keywords python3 json jsoneditor api gui editor csv
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 💥py-jsoneditor💥
Quickly View and Edit any JSON data.


# Why?

When working with JSON data, You often need to get a structured view of the JSON in order to be able to work with it. There's an online tool [https://jsoneditoronline.org/](https://jsoneditoronline.org/) which I used for this, but copying/pasting all the time got frustrating pretty quickly, This is why I created this package which you can launch right from Python or from the command line.


# Screenshot

![](https://res.cloudinary.com/dermasmid/image/upload/v1624745064/Screenshot_from_2021-06-27_01-02-58_qymcrb.png)


# Installation

```bash
pip install jsoneditor
```


# Python example

In python you can simply import `jsoneditor` and call the `editjson` function, the first argument is going to be the data. See [Formats you can pass the JSON as](#formats-you-can-pass-the-json-as) for all the formats you can pass the JSON in. See [Python api](#python-api) for a full list of addtional arguments that you can pass to `editjson`.
```python
import requests
import jsoneditor

data = requests.get('https://jsonplaceholder.typicode.com/comments').json()
jsoneditor.editjson(data)
```


# Command line example

From the command line you can either pass the data as an argument as so:
```bash
jsoneditor '{"Hey": "Hi"}'
```
Or you can pipe it in like so:
```bash
curl https://jsonplaceholder.typicode.com/comments | jsoneditor
```
Or you can use what you have in your clipboard like so:
```bash
jsoneditor -c
```
See [Formats you can pass the JSON as](#formats-you-can-pass-the-json-as) for all the formats you can pass the JSON in.

Refer to [CLI options](#cli-options) for a list of all cli options. Alternatively you can run `jsoneditor --help` from your terminal to see it.


## <a></a>Formats you can pass the JSON as

You can pass the json in any of the following formats:
* as valid json string. Example: `{"Hey": "Hi"}`
* as a python dict. Example: `{'Hey': 'hi'}`
* as a url the points to valid json. Example: `https://jsonplaceholder.typicode.com/comments`
* as a file path that is valid json. Example: `data.json`


## <a></a>Python Api

| parameter | type    | optional  |description                                                                  |
| --------- | ------- | -------- |-----------------------------------------------------------------------------|
| `data`    | `Any`     | ❌ |  The data in any of [these](#formats-you-can-pass-the-json-as) formats.       |
| `callback`| `callable`| ✔️ |  If you provide this argument you will have a ✅ button which will trigger this callback.|
| `options` | `dict`    | ✔️ | Options to pass the the jsoneditor object. See [here](https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#configuration-options)|
| `additional_js`| `str`| ✔️ |  You can pass some JavaScript to run on the client side. You can interact with the editor by accessing the `window.editor` variable.|
| `keep_running`| `bool` | ✔️ | Whether to keep the server running. Defaults to `False`.                 |
| `run_in_thread`| `bool` | ✔️ | Whether to run the server in a separate thread. Defaults to `False`.    |
| `is_csv`| `bool` | ✔️ | Whether the data is csv data. Defaults to `False`.                             |
| `is_yaml`| `bool` | ✔️ | Whether the data is yaml data. Defaults to `False`.                           |
| `is_ndjson`| `bool` | ✔️ | Whether the data is Newline Delimited JSON  . Defaults to `False`.          |
| `is_js_object`| `bool` | ✔️ | Whether the data is a JavaScript Object. Defaults to `False`.            |
| `title`| `str` | ✔️ | A title to display in the browser.                                               |
| `port`| `int` | ✔️ | specify which port to use.                                                        |


## <a></a>CLI options

| parameter | description                                                           |
| --------- | ----------------------------------------------------------------------|
| `data`    | The data in any of [these](#formats-you-can-pass-the-json-as) formats |
| `-o`      | Add a button that will output the json back to the console            |
| `-b`      | Keep running in background                                            |
| `-c`      | Get JSON input from clipboard                                         |
| `-k`      | Keep alive                                                            |
| `-e`      | Edit mode                                                             |
| `-n`      | Don't launch browser                                                  |
| `-p`      | Server port                                                           |
| `--out`   | File to output when in edit mode                                      |
| `-t`      | Title to display in browser window                                    |
| `--csv`   | Input is CSV                                                          |
| `--yaml`  | Input is YAML                                                         |
| `--js`    | Input is a JavaScript Object                                          |
| `--ndjson`| Input is Newline Delimited JSON                                       |


## Build

```bash
python setup.py sdist
```

# Acknowledgements

* [jsoneditor](https://github.com/josdejong/jsoneditor)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dermasmid/py-jsoneditor",
    "name": "jsoneditor",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "python3 json jsoneditor api gui editor csv",
    "author": "Cheskel Twersky",
    "author_email": "twerskycheskel@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/80/75/121a6da293cd63ae4ae4d4b38a836d020df5d987959bb946e16060deae18/jsoneditor-1.6.0.tar.gz",
    "platform": null,
    "description": "# \ud83d\udca5py-jsoneditor\ud83d\udca5\nQuickly View and Edit any JSON data.\n\n\n# Why?\n\nWhen working with JSON data, You often need to get a structured view of the JSON in order to be able to work with it. There's an online tool [https://jsoneditoronline.org/](https://jsoneditoronline.org/) which I used for this, but copying/pasting all the time got frustrating pretty quickly, This is why I created this package which you can launch right from Python or from the command line.\n\n\n# Screenshot\n\n![](https://res.cloudinary.com/dermasmid/image/upload/v1624745064/Screenshot_from_2021-06-27_01-02-58_qymcrb.png)\n\n\n# Installation\n\n```bash\npip install jsoneditor\n```\n\n\n# Python example\n\nIn python you can simply import `jsoneditor` and call the `editjson` function, the first argument is going to be the data. See [Formats you can pass the JSON as](#formats-you-can-pass-the-json-as) for all the formats you can pass the JSON in. See [Python api](#python-api) for a full list of addtional arguments that you can pass to `editjson`.\n```python\nimport requests\nimport jsoneditor\n\ndata = requests.get('https://jsonplaceholder.typicode.com/comments').json()\njsoneditor.editjson(data)\n```\n\n\n# Command line example\n\nFrom the command line you can either pass the data as an argument as so:\n```bash\njsoneditor '{\"Hey\": \"Hi\"}'\n```\nOr you can pipe it in like so:\n```bash\ncurl https://jsonplaceholder.typicode.com/comments | jsoneditor\n```\nOr you can use what you have in your clipboard like so:\n```bash\njsoneditor -c\n```\nSee [Formats you can pass the JSON as](#formats-you-can-pass-the-json-as) for all the formats you can pass the JSON in.\n\nRefer to [CLI options](#cli-options) for a list of all cli options. Alternatively you can run `jsoneditor --help` from your terminal to see it.\n\n\n## <a></a>Formats you can pass the JSON as\n\nYou can pass the json in any of the following formats:\n* as valid json string. Example: `{\"Hey\": \"Hi\"}`\n* as a python dict. Example: `{'Hey': 'hi'}`\n* as a url the points to valid json. Example: `https://jsonplaceholder.typicode.com/comments`\n* as a file path that is valid json. Example: `data.json`\n\n\n## <a></a>Python Api\n\n| parameter | type    | optional  |description                                                                  |\n| --------- | ------- | -------- |-----------------------------------------------------------------------------|\n| `data`    | `Any`     | \u274c |  The data in any of [these](#formats-you-can-pass-the-json-as) formats.       |\n| `callback`| `callable`| \u2714\ufe0f |  If you provide this argument you will have a \u2705 button which will trigger this callback.|\n| `options` | `dict`    | \u2714\ufe0f | Options to pass the the jsoneditor object. See [here](https://github.com/josdejong/jsoneditor/blob/master/docs/api.md#configuration-options)|\n| `additional_js`| `str`| \u2714\ufe0f |  You can pass some JavaScript to run on the client side. You can interact with the editor by accessing the `window.editor` variable.|\n| `keep_running`| `bool` | \u2714\ufe0f | Whether to keep the server running. Defaults to `False`.                 |\n| `run_in_thread`| `bool` | \u2714\ufe0f | Whether to run the server in a separate thread. Defaults to `False`.    |\n| `is_csv`| `bool` | \u2714\ufe0f | Whether the data is csv data. Defaults to `False`.                             |\n| `is_yaml`| `bool` | \u2714\ufe0f | Whether the data is yaml data. Defaults to `False`.                           |\n| `is_ndjson`| `bool` | \u2714\ufe0f | Whether the data is Newline Delimited JSON  . Defaults to `False`.          |\n| `is_js_object`| `bool` | \u2714\ufe0f | Whether the data is a JavaScript Object. Defaults to `False`.            |\n| `title`| `str` | \u2714\ufe0f | A title to display in the browser.                                               |\n| `port`| `int` | \u2714\ufe0f | specify which port to use.                                                        |\n\n\n## <a></a>CLI options\n\n| parameter | description                                                           |\n| --------- | ----------------------------------------------------------------------|\n| `data`    | The data in any of [these](#formats-you-can-pass-the-json-as) formats |\n| `-o`      | Add a button that will output the json back to the console            |\n| `-b`      | Keep running in background                                            |\n| `-c`      | Get JSON input from clipboard                                         |\n| `-k`      | Keep alive                                                            |\n| `-e`      | Edit mode                                                             |\n| `-n`      | Don't launch browser                                                  |\n| `-p`      | Server port                                                           |\n| `--out`   | File to output when in edit mode                                      |\n| `-t`      | Title to display in browser window                                    |\n| `--csv`   | Input is CSV                                                          |\n| `--yaml`  | Input is YAML                                                         |\n| `--js`    | Input is a JavaScript Object                                          |\n| `--ndjson`| Input is Newline Delimited JSON                                       |\n\n\n## Build\n\n```bash\npython setup.py sdist\n```\n\n# Acknowledgements\n\n* [jsoneditor](https://github.com/josdejong/jsoneditor)\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Visualize and edit JSON",
    "version": "1.6.0",
    "project_urls": {
        "Homepage": "https://github.com/dermasmid/py-jsoneditor"
    },
    "split_keywords": [
        "python3",
        "json",
        "jsoneditor",
        "api",
        "gui",
        "editor",
        "csv"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8075121a6da293cd63ae4ae4d4b38a836d020df5d987959bb946e16060deae18",
                "md5": "bedf12aa882e9ca698357a7707f84593",
                "sha256": "4b73b5064d2dda7d660567a02e75c495b8990318e46f14677c488ceeeb5571e1"
            },
            "downloads": -1,
            "filename": "jsoneditor-1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "bedf12aa882e9ca698357a7707f84593",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 259564,
            "upload_time": "2023-06-19T19:29:32",
            "upload_time_iso_8601": "2023-06-19T19:29:32.928854Z",
            "url": "https://files.pythonhosted.org/packages/80/75/121a6da293cd63ae4ae4d4b38a836d020df5d987959bb946e16060deae18/jsoneditor-1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-19 19:29:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dermasmid",
    "github_project": "py-jsoneditor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "jsoneditor"
}
        
Elapsed time: 0.09092s