json-source-map


Namejson-source-map JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/open-alchemy/json-source-map/wiki
SummaryCalculate the source map for a JSON document.
upload_time2022-12-20 12:01:25
maintainer
docs_urlNone
authorDavid Andersson
requires_python>=3.8,<4.0
license
keywords python json source map
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # JsonSourceMap

Calculate JSON Pointers to each value within a JSON document along with the
line, column and character position for the start and end of that value. For
more information see: <https://github.com/open-alchemy/json-source-map/wiki>.

For example:

```bash
python -m pip install json_source_map
```

```Python
from json_source_map import calculate


print(calculate('{"foo": "bar"}'))
```

The above prints:

```Python
{
    '': Entry(
        value_start=Location(line=0, column=0, position=0),
        value_end=Location(line=0, column=14, position=14),
        key_start=None,
        key_end=None,
    ),
    '/foo': Entry(
        value_start=Location(line=0, column=8, position=8),
        value_end=Location(line=0, column=13, position=13),
        key_start=Location(line=0, column=1, position=1),
        key_end=Location(line=0, column=6, position=6),
    ),
}
```

Where:

- each key in the dictionary is a JSON path to an item,
- each value in the dictionarty contains the mapping of the item at the JSON
  path which have the following properties:
  - `value_start` is the start of the value,
  - `value_end` is the end of the value,
  - `key_start` is the start of the key (which is `None` at the root level and
    for array items),
  - `key_end` is the end of the key (which is `None` at the root level and for
    array items) and
- each of the above have the following properties:
  - `line` is the zero-indexed line position,
  - `column` is the zero-indexed column position and
  - `position` is the zero-indexed character position in the string
    (independent of the line and column).

The following features have been implemented:

- support for primitive types (`strings`, `numbers`, `booleans` and `null`),
- support for structural types (`array` and `object`) and
- support for space, tab, carriage and return whitespace.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/open-alchemy/json-source-map/wiki",
    "name": "json-source-map",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "Python,JSON,source map",
    "author": "David Andersson",
    "author_email": "nderssonpublic@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e6/f0/560df0f36ad3e6c1e9b2a077a297df2c4dc4a2c427580d1995782aff67d1/json_source_map-1.0.5.tar.gz",
    "platform": null,
    "description": "# JsonSourceMap\n\nCalculate JSON Pointers to each value within a JSON document along with the\nline, column and character position for the start and end of that value. For\nmore information see: <https://github.com/open-alchemy/json-source-map/wiki>.\n\nFor example:\n\n```bash\npython -m pip install json_source_map\n```\n\n```Python\nfrom json_source_map import calculate\n\n\nprint(calculate('{\"foo\": \"bar\"}'))\n```\n\nThe above prints:\n\n```Python\n{\n    '': Entry(\n        value_start=Location(line=0, column=0, position=0),\n        value_end=Location(line=0, column=14, position=14),\n        key_start=None,\n        key_end=None,\n    ),\n    '/foo': Entry(\n        value_start=Location(line=0, column=8, position=8),\n        value_end=Location(line=0, column=13, position=13),\n        key_start=Location(line=0, column=1, position=1),\n        key_end=Location(line=0, column=6, position=6),\n    ),\n}\n```\n\nWhere:\n\n- each key in the dictionary is a JSON path to an item,\n- each value in the dictionarty contains the mapping of the item at the JSON\n  path which have the following properties:\n  - `value_start` is the start of the value,\n  - `value_end` is the end of the value,\n  - `key_start` is the start of the key (which is `None` at the root level and\n    for array items),\n  - `key_end` is the end of the key (which is `None` at the root level and for\n    array items) and\n- each of the above have the following properties:\n  - `line` is the zero-indexed line position,\n  - `column` is the zero-indexed column position and\n  - `position` is the zero-indexed character position in the string\n    (independent of the line and column).\n\nThe following features have been implemented:\n\n- support for primitive types (`strings`, `numbers`, `booleans` and `null`),\n- support for structural types (`array` and `object`) and\n- support for space, tab, carriage and return whitespace.\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Calculate the source map for a JSON document.",
    "version": "1.0.5",
    "project_urls": {
        "Documentation": "https://github.com/open-alchemy/json-source-map/wiki",
        "Homepage": "https://github.com/open-alchemy/json-source-map/wiki",
        "Repository": "https://github.com/open-alchemy/json-source-map"
    },
    "split_keywords": [
        "python",
        "json",
        "source map"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2f5cbdddb48cf521428117bd1338c531c0027f1c32beba23c89f9713229fe17c",
                "md5": "8aceed45ba1e43dc176f615468bbc248",
                "sha256": "c8ddb8db76dc238fce485abb548e5c7fc2b44d5ae8efb766e90e7c15840afaca"
            },
            "downloads": -1,
            "filename": "json_source_map-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8aceed45ba1e43dc176f615468bbc248",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 7432,
            "upload_time": "2022-12-20T12:01:24",
            "upload_time_iso_8601": "2022-12-20T12:01:24.323970Z",
            "url": "https://files.pythonhosted.org/packages/2f/5c/bdddb48cf521428117bd1338c531c0027f1c32beba23c89f9713229fe17c/json_source_map-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e6f0560df0f36ad3e6c1e9b2a077a297df2c4dc4a2c427580d1995782aff67d1",
                "md5": "a7fc7f346e10edfea1c01f92904e5b97",
                "sha256": "de99103c0637707368eb888d7aaa82bad1e21dbe2d21813998caabaa7c2e52f9"
            },
            "downloads": -1,
            "filename": "json_source_map-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "a7fc7f346e10edfea1c01f92904e5b97",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 6676,
            "upload_time": "2022-12-20T12:01:25",
            "upload_time_iso_8601": "2022-12-20T12:01:25.669462Z",
            "url": "https://files.pythonhosted.org/packages/e6/f0/560df0f36ad3e6c1e9b2a077a297df2c4dc4a2c427580d1995782aff67d1/json_source_map-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-20 12:01:25",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "open-alchemy",
    "github_project": "json-source-map",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "json-source-map"
}
        
Elapsed time: 0.19199s