| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A Python implementation of the JSON5 data format.
JSON5 extends the JSON data interchange format to make it slightly more usable as a configuration language:
JavaScript-style comments (both single and multi-line) are legal.
Object keys may be unquoted if they are legal ECMAScript identifiers
Objects and arrays may end with trailing commas.
Strings can be single-quoted, and multi-line string literals are allowed.
There are a few other more minor extensions to JSON; see the above page for the full details.
This project implements a reader and writer implementation for Python; where possible, it mirrors the standard Python JSON API package for ease of use.
There is one notable difference from the JSON api: the load() and loads() methods support optionally checking for (and rejecting) duplicate object keys; pass allow_duplicate_keys=False to do so (duplicates are allowed by default).
This is an early release. It has been reasonably well-tested, but it is SLOW. It can be 1000-6000x slower than the C-optimized JSON module, and is 200x slower (or more) than the pure Python JSON module.
Please Note: This library only handles JSON5 documents, it does not allow you to read arbitrary JavaScript. For example, bare integers can be legal object keys in JavaScript, but they aren't in JSON5.
Did I mention that it is SLOW?
The implementation follows Python3's json implementation where possible. This means that the encoding method to dump() is ignored, and unicode strings are always returned.
The cls keyword argument that json.load()/json.loads() accepts to specify a custom subclass of JSONDecoder is not and will not be supported, because this implementation uses a completely different approach to parsing strings and doesn't have anything like the JSONDecoder class.
The cls keyword argument that json.dump()/json.dumps() accepts is also not supported, for consistency with json5.load(). The default keyword is supported, though, and might be able to serve as a workaround.
json5 have no runtime dependencies and it is supported on Python version 3.8 or later. However, in order to develop and build the package you need a bunch of extra tools and the latest versions of those tools may require 3.9 or later. You can install the extra environment on 3.8 (and get older versions of the tools), but they may not run completely cleanly.
The easiest thing to do is to install uv and use uv and the //run script to develop things. See ./run --help for the various commands that are supported. glop is the parser generator tool used to generate a parser from the grammar in json5/json5.g.
$ brew install uv $ git clone https://github.com/dpranke/pyjson5 $ git clone https://github.com/dpranke/glop $ cd pyjson5 $ source $(./run devenv) # To activate a venv w/ all the needed dev tools.
Install uv via whatever mechanism is appropriate.
$ ./run devenv
(This calls uv sync --extra dev.)
$ ./run tests
# Update the version in json5/version.py to $VERSION, which should be of # the form X.Y.Z where X, Y, and Z are numbers. $ ./run regen $ ./run presubmit $ git commit -a -m "Bump the version to $VERSION" $ git tag "v$VERSION" $ ./run build $ ./run publish --prod $ git push origin $ git push --tags origin
(Assuming you have upload privileges to PyPI and the GitHub repo, of course.)
v0.15.0 (2026-06-19)
v0.14.0 (2026-03-27) This is really just a dependency bump release.
v0.13.0 (2026-01-01)
v0.12.1 (2025-08-12)
v0.12.0 (2025-04-03)
v0.11.0 (2025-04-01)
v0.10.0 (2024-11-25)
v0.9.28 (2024-11-11)
v0.9.27 (2024-11-10)
v0.9.26 (2024-11-10)
v0.9.25 (2024-04-12)
v0.9.24 (2024-03-16)
v0.9.23 (2024-03-16)
v0.9.22 (2024-03-06)
v0.9.21 (2024-03-06)
v0.9.20 (2024-03-03)
v0.9.19 (2024-03-03)
v0.9.18 (2024-02-29)
v0.9.17 (2024-02-19)
v0.9.16 (2024-02-19)
v0.9.15 (2024-02-19)
v0.9.14 (2023-05-14)
v0.9.13 (2023-03-16)
v0.9.12 (2023-01-02)
v0.9.11 (2023-01-02)
v0.9.10 (2022-08-18)
v0.9.9 (2022-08-01)
v0.9.8 (2022-05-08)
v0.9.7 (2022-05-06)
v0.9.6 (2021-06-21)
v0.9.5 (2020-05-26)
v0.9.4 (2020-03-26)
v0.9.3 (2020-03-17)
v0.9.2 (2020-03-02)
v0.9.1 (2020-02-09)
v0.9.0 (2020-01-30)
v0.8.5 (2019-07-04)
v0.8.4 (2019-06-11)
v0.8.3 (2019-06-11)
v0.8.2 (2019-06-11)
v0.8.1 (2019-06-11)
v0.8.0 (2019-06-11)
v0.7 (2019-03-31)
v0.6.2 (2019-03-08)
v0.6.1 (2018-05-22)
v0.6.0 (2017-11-28)
v0.5.0 (2017-09-04)
| Back | FazBrowse Home | New Git URL |