Name | demjson3 JSON |
Version |
3.0.6
JSON |
| download |
home_page | |
Summary | encoder, decoder, and lint/validator for JSON (JavaScript Object Notation) compliant with RFC 7159 |
upload_time | 2022-10-22 19:09:05 |
maintainer | |
docs_url | None |
author | Deron Meranda |
requires_python | |
license | GNU LGPL 3.0 |
keywords |
json
jsonlint
javascript
utf-32
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
demjson3
=======
[![Build Status](https://app.travis-ci.com/nielstron/demjson3.svg?branch=master)](https://app.travis-ci.com/nielstron/demjson3)
[![Coverage Status](https://coveralls.io/repos/github/nielstron/demjson3/badge.svg?branch=master)](https://coveralls.io/github/nielstron/demjson3?branch=master)
[![Package Version](https://img.shields.io/pypi/v/demjson3)](https://pypi.org/project/demjson3/)
[![Python Versions](https://img.shields.io/pypi/pyversions/demjson3.svg)](https://pypi.org/project/demjson3/)
This is a fork of the popular tool [demjson](https://github.com/dmeranda/demjson) to only support Python 3.
The decision to do this is mainly based on all the headache caused
by trying to support Python 2 AND 3.
<b>demjson3</b> is a [Python language](http://python.org/) module for
encoding, decoding, and syntax-checking [JSON](http://json.org/)
data. It works under Python 3.
It comes with a <b>jsonlint</b> script which can be used to validate
your JSON documents for strict conformance to the JSON specification,
and to detect potential data portability issues. It can also reformat
or pretty-print JSON documents; either by re-indenting or removing
unnecessary whitespace.
What's new
==========
<b>Version 3.0.0</b> will start to only work under Python 3.
<b>Version 2.2.4</b> fixes problem with jsonlint under Python 3 when
trying to reformat JSON (-f or -F options) and writing the output to
standard output.
<b>Version 2.2.3</b> fixes incorrect return values from the "jsonlint"
command. Also fixes a minor problem with the included unit tests in
certain Python versions.
<b>Version 2.2.2</b> fixes installation problems with certain Python 3
versions prior to Python 3.4. No other changes.
<b>Version 2.2.1</b> adds an enhancement for HTML safety, and a few
obscure bug fixes.
<b>Version 2.2</b> fixes compatibility with Python 2.6 and
narrow-Unicode Pythons, fixes bugs with statistics, and adds many
enhancements to the treatment of numbers and floating-point values.
<b>Version 2.0.1</b> is a re-packaging of 2.0, after discovering
problems with incorrect checksums in the PyPI distribution of 2.0. No
changes were made from 2.0.
<b>Version 2.0</b>, released 2014-05-21, is a MAJOR new version with many
changes and improvements.
Visit http://nielstron.github.io/demjson3/ for complete details and documentation. Additional documentation may also be found
under the "docs/" folder of the source.
The biggest changes in 2.0 include:
* Now works in Python 3; minimum version supported is Python 2.6
* Much improved reporting of errors and warnings
* Extensible with user-supplied hooks
* Handles many additional Python data types automatically
* Statistics
There are many more changes.
Example use
===========
To use demjson3 from within your Python programs:
```python
>>> import demjson3
>>> demjson3.encode( ['one',42,True,None] ) # From Python to JSON
'["one",42,true,null]'
>>> demjson3.decode( '["one",42,true,null]' ) # From JSON to Python
['one', 42, True, None]
```
To check a JSON data file for errors or problems:
```bash
$ jsonlint my.json
my.json:1:8: Error: Numbers may not have extra leading zeros: '017'
| At line 1, column 8, offset 8
my.json:4:10: Warning: Object contains same key more than once: 'Name'
| At line 4, column 10, offset 49
| Object started at line 1, column 0, offset 0 (AT-START)
my.json:9:11: Warning: Integers larger than 53-bits are not portable
| At line 9, column 11, offset 142
my.json: has errors
```
Why use demjson3?
================
I wrote demjson3 before Python had any JSON support in its standard
library. If all you need is to be able to read or write JSON data,
then you may wish to just use what's built into Python.
However demjson3 is extremely feature rich and is quite useful in
certain applications. It is especially good at error checking
JSON data and for being able to parse more of the JavaScript syntax
than is permitted by strict JSON.
A few advantages of demjson3 are:
* It generally has better error handling and "lint" checking capabilities;
* It will automatically use the Python Decimal (bigfloat) class
instead of a floating-point number whenever there might be an
overflow or loss of precision otherwise.
* It can correctly deal with different Unicode encodings, including ASCII.
It will automatically adapt when to use \u-escapes based on the encoding.
* It generates more conservative JSON, such as escaping Unicode
format control characters or line terminators, which should improve
data portability.
* In non-strict mode it can also deal with slightly non-conforming
input that is more JavaScript than JSON (such as allowing comments).
* It supports a broader set of Python types during conversion.
Installation
============
To install, type:
```bash
python setup.py install
```
or optionally just copy the file "demjson3.py" to whereever you want.
See "docs/INSTALL.txt" for more detailed instructions, including how
to run the self-tests.
More information
================
See the files under the "docs" subdirectory. The module is also
self-documented, so within the python interpreter type:
```python
import demjson3
help(demjson3)
```
or from a shell command line:
```bash
pydoc demjson3
```
The "jsonlint" command script which gets installed as part of demjson3
has built-in usage instructions as well. Just type:
```bash
jsonlint --help
```
Complete documentation and additional information is also available
on the project homepage at http://nielstron.github.io/demjson3/
It is also available on the Python Package Index (PyPI) at
http://pypi.python.org/pypi/demjson3/
License
=======
LGPLv3 - See the included "LICENSE.txt" file.
This software is Free Software and is licensed under the terms of the
GNU LGPL (GNU Lesser General Public License). More information is
found at the top of the demjson3.py source file and the included
LICENSE.txt file.
Releases prior to 1.4 were released under a different license, be
sure to check the corresponding LICENSE.txt file included with them.
This software was written by Deron Meranda, http://deron.meranda.us/ and adjusted
for Python 3 only support by Niels Mündler.
Raw data
{
"_id": null,
"home_page": "",
"name": "demjson3",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "JSON,jsonlint,JavaScript,UTF-32",
"author": "Deron Meranda",
"author_email": "deron.meranda@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/f7/d2/6a81a9b5311d50542e11218b470dafd8adbaf1b3e51fc1fddd8a57eed691/demjson3-3.0.6.tar.gz",
"platform": null,
"description": "demjson3\n=======\n[![Build Status](https://app.travis-ci.com/nielstron/demjson3.svg?branch=master)](https://app.travis-ci.com/nielstron/demjson3)\n[![Coverage Status](https://coveralls.io/repos/github/nielstron/demjson3/badge.svg?branch=master)](https://coveralls.io/github/nielstron/demjson3?branch=master)\n[![Package Version](https://img.shields.io/pypi/v/demjson3)](https://pypi.org/project/demjson3/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/demjson3.svg)](https://pypi.org/project/demjson3/)\n\nThis is a fork of the popular tool [demjson](https://github.com/dmeranda/demjson) to only support Python 3.\nThe decision to do this is mainly based on all the headache caused\nby trying to support Python 2 AND 3.\n\n<b>demjson3</b> is a [Python language](http://python.org/) module for\nencoding, decoding, and syntax-checking [JSON](http://json.org/)\ndata. It works under Python 3.\n\nIt comes with a <b>jsonlint</b> script which can be used to validate\nyour JSON documents for strict conformance to the JSON specification,\nand to detect potential data portability issues. It can also reformat\nor pretty-print JSON documents; either by re-indenting or removing\nunnecessary whitespace.\n\n\nWhat's new\n==========\n\n<b>Version 3.0.0</b> will start to only work under Python 3.\n\n<b>Version 2.2.4</b> fixes problem with jsonlint under Python 3 when\ntrying to reformat JSON (-f or -F options) and writing the output to\nstandard output.\n\n<b>Version 2.2.3</b> fixes incorrect return values from the \"jsonlint\"\ncommand. Also fixes a minor problem with the included unit tests in\ncertain Python versions.\n\n<b>Version 2.2.2</b> fixes installation problems with certain Python 3\nversions prior to Python 3.4. No other changes.\n\n<b>Version 2.2.1</b> adds an enhancement for HTML safety, and a few\nobscure bug fixes.\n\n<b>Version 2.2</b> fixes compatibility with Python 2.6 and\nnarrow-Unicode Pythons, fixes bugs with statistics, and adds many\nenhancements to the treatment of numbers and floating-point values.\n\n<b>Version 2.0.1</b> is a re-packaging of 2.0, after discovering\nproblems with incorrect checksums in the PyPI distribution of 2.0. No\nchanges were made from 2.0.\n\n<b>Version 2.0</b>, released 2014-05-21, is a MAJOR new version with many\nchanges and improvements.\n\nVisit http://nielstron.github.io/demjson3/ for complete details and documentation. Additional documentation may also be found\nunder the \"docs/\" folder of the source.\n\nThe biggest changes in 2.0 include:\n\n * Now works in Python 3; minimum version supported is Python 2.6\n * Much improved reporting of errors and warnings\n * Extensible with user-supplied hooks\n * Handles many additional Python data types automatically\n * Statistics\n\nThere are many more changes.\n\n\nExample use\n===========\n\nTo use demjson3 from within your Python programs:\n\n```python\n >>> import demjson3\n\n >>> demjson3.encode( ['one',42,True,None] ) # From Python to JSON\n '[\"one\",42,true,null]'\n\n >>> demjson3.decode( '[\"one\",42,true,null]' ) # From JSON to Python\n ['one', 42, True, None]\n```\n\nTo check a JSON data file for errors or problems:\n\n```bash\n $ jsonlint my.json\n\n my.json:1:8: Error: Numbers may not have extra leading zeros: '017'\n | At line 1, column 8, offset 8\n my.json:4:10: Warning: Object contains same key more than once: 'Name'\n | At line 4, column 10, offset 49\n | Object started at line 1, column 0, offset 0 (AT-START)\n my.json:9:11: Warning: Integers larger than 53-bits are not portable\n | At line 9, column 11, offset 142\n my.json: has errors\n```\n\n\nWhy use demjson3?\n================\n\nI wrote demjson3 before Python had any JSON support in its standard\nlibrary. If all you need is to be able to read or write JSON data,\nthen you may wish to just use what's built into Python.\n\nHowever demjson3 is extremely feature rich and is quite useful in\ncertain applications. It is especially good at error checking\nJSON data and for being able to parse more of the JavaScript syntax\nthan is permitted by strict JSON.\n\nA few advantages of demjson3 are:\n\n * It generally has better error handling and \"lint\" checking capabilities;\n\n * It will automatically use the Python Decimal (bigfloat) class\n instead of a floating-point number whenever there might be an\n overflow or loss of precision otherwise.\n\n * It can correctly deal with different Unicode encodings, including ASCII.\n It will automatically adapt when to use \\u-escapes based on the encoding.\n\n * It generates more conservative JSON, such as escaping Unicode\n format control characters or line terminators, which should improve\n data portability.\n\n * In non-strict mode it can also deal with slightly non-conforming\n input that is more JavaScript than JSON (such as allowing comments).\n\n * It supports a broader set of Python types during conversion.\n\n\nInstallation\n============\n\nTo install, type:\n\n```bash\n python setup.py install\n```\n\nor optionally just copy the file \"demjson3.py\" to whereever you want.\nSee \"docs/INSTALL.txt\" for more detailed instructions, including how\nto run the self-tests.\n\n\nMore information\n================\n\nSee the files under the \"docs\" subdirectory. The module is also\nself-documented, so within the python interpreter type:\n\n```python\n import demjson3\n help(demjson3)\n```\n\nor from a shell command line:\n\n```bash\n pydoc demjson3\n```\n\nThe \"jsonlint\" command script which gets installed as part of demjson3\nhas built-in usage instructions as well. Just type:\n\n```bash\n jsonlint --help\n```\n\nComplete documentation and additional information is also available\non the project homepage at http://nielstron.github.io/demjson3/\n\nIt is also available on the Python Package Index (PyPI) at\nhttp://pypi.python.org/pypi/demjson3/\n\n\nLicense\n=======\n\nLGPLv3 - See the included \"LICENSE.txt\" file.\n\nThis software is Free Software and is licensed under the terms of the\nGNU LGPL (GNU Lesser General Public License). More information is\nfound at the top of the demjson3.py source file and the included\nLICENSE.txt file.\n\nReleases prior to 1.4 were released under a different license, be\nsure to check the corresponding LICENSE.txt file included with them.\n\nThis software was written by Deron Meranda, http://deron.meranda.us/ and adjusted\nfor Python 3 only support by Niels M\u00fcndler.\n",
"bugtrack_url": null,
"license": "GNU LGPL 3.0",
"summary": "encoder, decoder, and lint/validator for JSON (JavaScript Object Notation) compliant with RFC 7159",
"version": "3.0.6",
"split_keywords": [
"json",
"jsonlint",
"javascript",
"utf-32"
],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "633358a7845bd6fa5f66879256b00268",
"sha256": "37c83b0c6eb08d25defc88df0a2a4875d58a7809a9650bd6eee7afd8053cdbac"
},
"downloads": -1,
"filename": "demjson3-3.0.6.tar.gz",
"has_sig": false,
"md5_digest": "633358a7845bd6fa5f66879256b00268",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 131477,
"upload_time": "2022-10-22T19:09:05",
"upload_time_iso_8601": "2022-10-22T19:09:05.379379Z",
"url": "https://files.pythonhosted.org/packages/f7/d2/6a81a9b5311d50542e11218b470dafd8adbaf1b3e51fc1fddd8a57eed691/demjson3-3.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-10-22 19:09:05",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "demjson3"
}