SJSON


NameSJSON JSON
Version 2.1.1 PyPI version JSON
download
home_pageNone
SummarySJSON serializer/deserializer for Python
upload_time2024-08-17 14:13:51
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseBSD 3-clause license
keywords sjson
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            SJSON
=====

**SJSON** is a small library to read/write simplified JSON, as described originally on the [Bitsquid blog](http://bitsquid.blogspot.de/2009/10/simplified-json-notation.html).

License
-------

**SJSON** is licensed under the two-clause BSD license. See `LICENSE.txt` for details.

SJSON format
------------

SJSON is very similar to normal JSON (in fact, since release 1.2.0, the SJSON library will also load plain JSON). It mostly reduces the required markup a bit. The main differences are:

* Every file starts with an implicit object. That is, an empty SJSON file is equivalent to a JSON file containing `{}`.
* Commas after a key-value pair are optional.
* Keys don't have to be quoted as long as they are valid identifiers. An identifier consists of letters, digits, and `_`.
* `=` is allowed in addition to `:` for key-value separation. The canonical separator is `=`.
* C and C++ style comments are allowed.

In addition, this library provides support for raw string literals.

Example
-------

JSON:

    {
        "foo" : 23,
        "bar" : [1, 2, 3],
        "baz" : {
            "key" : "value"
        }
    }

SJSON:

    foo = 23
    bar = [1, 2, 3]
    baz = {
        // SJSON also allows for comments
        key = "value"
    }

As an extension, SJSON allows for raw string literals, in both Lua and Python flavors:

    foo = [=[This is a raw literal with embedded " and stuff]=]

    foo = """This is a raw literal with embedded " and stuff"""

Usage
-----

The library provides four methods, similar to the Python JSON module. These are:

* `dump`: Encode an object as SJSON and write to a stream.
* `dumps`: Encode an object as SJSON and return a string.
* `load`: Decode a SJSON encoded object from a stream.
* `loads`: Decode a SJSON encoded object from a string.

Changelog
---------

### 2.1.1

* Packaging changes only. Raised supported Python version to Python 3.12

### 2.1

* Add support for Python-style raw strings, delimited by `"""`.
* Improve handling of unknown string escapes. Previously, those would raise an exception, now they get passed through.

### 2.0.3

* Re-release of 2.0.2.

### 2.0.2

* Packaging changes only. This release contains packaging changes only and has not been released to the public, use 2.0.3 instead.

### 2.0.1

* Add `dump` in addition to `dumps` for consistency with the Python JSON module.
* Additional PEP8 conformance tweaks.

### 2.0.0

* The library is now PEP8 compliant. This should *not* affect most users of this library, the only user-visible change is that `ParseException.GetLocation` has been renamed to `get_location`. The core functions have not been renamed and are API compatible.

### 1.2.0

* Keys did not get quoted properly during encoding if they contained special characters.
* List elements were incorrectly indented.
* List indentation now accepts either a string or a number (similar to the Python JSON module.)
* Both `:` and `=` are now supported as key-value separators, allowing the SJSON library to parse plain JSON files.

### 1.1.1

* Add support for C/C++ style comments.
* Line/column numbers start at 1 now (previously, the first character was in line 0, column 0).

### 1.1.0

* Parsing performance has been significantly improved.
* It is possible to parse a file-like stream or string now.

### 1.0.4

* Track position during parsing. This will likely reduce the performance a bit, but allows for much better error messages.
* Input is byte-oriented now.

### 1.0.3

* Add support for raw string literals. These are delimited by `[=[` `]=]` and don't require escaping inside the string.

### 1.0.2

* Strings with whitespace are now properly escaped.

### 1.0.1

* Various fixes to string encoding/decoding bugs.
* Encoding now uses `collections.abc` to identify sequences and mappings instead of testing directly against `list` and `dict`.

### 1.0.0

Initial PyPI release.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "SJSON",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "SJSON",
    "author": null,
    "author_email": "\"Matth\u00e4us G. Chajdas\" <dev@anteru.net>",
    "download_url": "https://files.pythonhosted.org/packages/b4/0e/d5f2d5186d9dc063b09f9bbbc63d1747272a484bb962fa1797132dcbc5ec/sjson-2.1.1.tar.gz",
    "platform": null,
    "description": "SJSON\n=====\n\n**SJSON** is a small library to read/write simplified JSON, as described originally on the [Bitsquid blog](http://bitsquid.blogspot.de/2009/10/simplified-json-notation.html).\n\nLicense\n-------\n\n**SJSON** is licensed under the two-clause BSD license. See `LICENSE.txt` for details.\n\nSJSON format\n------------\n\nSJSON is very similar to normal JSON (in fact, since release 1.2.0, the SJSON library will also load plain JSON). It mostly reduces the required markup a bit. The main differences are:\n\n* Every file starts with an implicit object. That is, an empty SJSON file is equivalent to a JSON file containing `{}`.\n* Commas after a key-value pair are optional.\n* Keys don't have to be quoted as long as they are valid identifiers. An identifier consists of letters, digits, and `_`.\n* `=` is allowed in addition to `:` for key-value separation. The canonical separator is `=`.\n* C and C++ style comments are allowed.\n\nIn addition, this library provides support for raw string literals.\n\nExample\n-------\n\nJSON:\n\n    {\n        \"foo\" : 23,\n        \"bar\" : [1, 2, 3],\n        \"baz\" : {\n            \"key\" : \"value\"\n        }\n    }\n\nSJSON:\n\n    foo = 23\n    bar = [1, 2, 3]\n    baz = {\n        // SJSON also allows for comments\n        key = \"value\"\n    }\n\nAs an extension, SJSON allows for raw string literals, in both Lua and Python flavors:\n\n    foo = [=[This is a raw literal with embedded \" and stuff]=]\n\n    foo = \"\"\"This is a raw literal with embedded \" and stuff\"\"\"\n\nUsage\n-----\n\nThe library provides four methods, similar to the Python JSON module. These are:\n\n* `dump`: Encode an object as SJSON and write to a stream.\n* `dumps`: Encode an object as SJSON and return a string.\n* `load`: Decode a SJSON encoded object from a stream.\n* `loads`: Decode a SJSON encoded object from a string.\n\nChangelog\n---------\n\n### 2.1.1\n\n* Packaging changes only. Raised supported Python version to Python 3.12\n\n### 2.1\n\n* Add support for Python-style raw strings, delimited by `\"\"\"`.\n* Improve handling of unknown string escapes. Previously, those would raise an exception, now they get passed through.\n\n### 2.0.3\n\n* Re-release of 2.0.2.\n\n### 2.0.2\n\n* Packaging changes only. This release contains packaging changes only and has not been released to the public, use 2.0.3 instead.\n\n### 2.0.1\n\n* Add `dump` in addition to `dumps` for consistency with the Python JSON module.\n* Additional PEP8 conformance tweaks.\n\n### 2.0.0\n\n* The library is now PEP8 compliant. This should *not* affect most users of this library, the only user-visible change is that `ParseException.GetLocation` has been renamed to `get_location`. The core functions have not been renamed and are API compatible.\n\n### 1.2.0\n\n* Keys did not get quoted properly during encoding if they contained special characters.\n* List elements were incorrectly indented.\n* List indentation now accepts either a string or a number (similar to the Python JSON module.)\n* Both `:` and `=` are now supported as key-value separators, allowing the SJSON library to parse plain JSON files.\n\n### 1.1.1\n\n* Add support for C/C++ style comments.\n* Line/column numbers start at 1 now (previously, the first character was in line 0, column 0).\n\n### 1.1.0\n\n* Parsing performance has been significantly improved.\n* It is possible to parse a file-like stream or string now.\n\n### 1.0.4\n\n* Track position during parsing. This will likely reduce the performance a bit, but allows for much better error messages.\n* Input is byte-oriented now.\n\n### 1.0.3\n\n* Add support for raw string literals. These are delimited by `[=[` `]=]` and don't require escaping inside the string.\n\n### 1.0.2\n\n* Strings with whitespace are now properly escaped.\n\n### 1.0.1\n\n* Various fixes to string encoding/decoding bugs.\n* Encoding now uses `collections.abc` to identify sequences and mappings instead of testing directly against `list` and `dict`.\n\n### 1.0.0\n\nInitial PyPI release.\n",
    "bugtrack_url": null,
    "license": "BSD 3-clause license",
    "summary": "SJSON serializer/deserializer for Python",
    "version": "2.1.1",
    "project_urls": {
        "Homepage": "http://sh13.net/projects/SJSON",
        "Issue Tracker": "https://github.com/anteru/sjson/issues",
        "Repository": "https://github.com/anteru/sjson"
    },
    "split_keywords": [
        "sjson"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "80dad78931e1e32c6f5f78dfcd45044de00c466fca7bb43827070a90747ac3b7",
                "md5": "7f859311c395f842d83e5d43f0d52aab",
                "sha256": "4b1c6a0c126e543c3cef5514ecd39ac48bd4d965bdf906658cfc0863eef30531"
            },
            "downloads": -1,
            "filename": "sjson-2.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7f859311c395f842d83e5d43f0d52aab",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8075,
            "upload_time": "2024-08-17T14:13:50",
            "upload_time_iso_8601": "2024-08-17T14:13:50.081155Z",
            "url": "https://files.pythonhosted.org/packages/80/da/d78931e1e32c6f5f78dfcd45044de00c466fca7bb43827070a90747ac3b7/sjson-2.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b40ed5f2d5186d9dc063b09f9bbbc63d1747272a484bb962fa1797132dcbc5ec",
                "md5": "c37159c427de4d14f893f7aa92141eb8",
                "sha256": "cf5780e66857924d94db3b82309338ff79082a5f9b53b0c48bced2fecca051c0"
            },
            "downloads": -1,
            "filename": "sjson-2.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "c37159c427de4d14f893f7aa92141eb8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 10311,
            "upload_time": "2024-08-17T14:13:51",
            "upload_time_iso_8601": "2024-08-17T14:13:51.246041Z",
            "url": "https://files.pythonhosted.org/packages/b4/0e/d5f2d5186d9dc063b09f9bbbc63d1747272a484bb962fa1797132dcbc5ec/sjson-2.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-17 14:13:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "anteru",
    "github_project": "sjson",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "sjson"
}
        
Elapsed time: 0.60794s