tree-sitter-hujson
A tree-sitter grammar for HuJSON (Human JSON), also known as JWCC (JSON With Commas and Comments).
HuJSON is a strict superset of JSON that adds exactly two features:
- C-style comments: line comments (
//) and block comments (/* */) - Trailing commas: an optional trailing comma after the last element in arrays and objects
All valid JSON is valid HuJSON. HuJSON intentionally rejects every other extension (unquoted keys, hex literals, Infinity/NaN, single-quoted strings, and so on); object keys must be quoted strings, exactly as in standard JSON.
The grammar registers both the .hujson and .jwcc file extensions.
Installation
The grammar is published to npm, PyPI, and crates.io. Each package exposes the compiled language for use with that ecosystem's tree-sitter bindings.
Each example needs the tree-sitter runtime for that language alongside this grammar.
npm (Node.js)
npm install tree-sitter tree-sitter-hujson
const Parser = require("tree-sitter");
const HuJSON = require("tree-sitter-hujson");
const parser = new Parser();
parser.setLanguage(HuJSON);
PyPI (Python)
pip install "tree-sitter-hujson[core]"
import tree_sitter_hujson
from tree_sitter import Language, Parser
parser = Parser(Language(tree_sitter_hujson.language()))
crates.io (Rust)
cargo add tree-sitter tree-sitter-hujson
let mut parser = tree_sitter::Parser::new();
parser
.set_language(&tree_sitter_hujson::LANGUAGE.into())
.expect("loading HuJSON grammar");
Go, Swift, and C
These bindings ship in the repository and are consumed directly from the tagged source rather than a package registry.
Editor support
- Zed: install the
ggfevans/zed-hujsonextension. This is the only editor integration maintained and tested here. - Other tree-sitter hosts (for example Neovim via nvim-treesitter, or Helix): this is a standard tree-sitter grammar and can be registered through each host's normal grammar mechanism.
Markdown code blocks fenced as ```hujson are highlighted in editors that resolve fence languages by name (verified in Zed). This works through the declared language scope and name; it needs no injections.scm on the grammar side, because the host Markdown grammar supplies the injection.
Provenance
Forked from tree-sitter/tree-sitter-json at commit 001c28d. The upstream grammar already supported comments, so HuJSON support needed only two changes:
-
Trailing commas. The
commaSephelper now allows an optional trailing comma:function commaSep1(rule) { return seq(rule, repeat(seq(",", rule)), optional(",")); }
-
String-only object keys. Upstream tree-sitter-json accepts numeric object keys (
choice($.string, $.number)); HuJSON restricts keys to strings to match standard JSON, so bare numeric keys are parse errors. This tightened in v0.2.0.
AI disclosure
This project discloses AI involvement following the ai-disclosure convention. See AI_DISCLOSURE.md for the repo-level default, and per-file headers for any overrides.
Contributing
See CONTRIBUTING.md for development setup, the test suite, and the release process.
Licence
MIT, matching the upstream tree-sitter-json licence.
Metadata
Release files for tree-sitter-hujson 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_hujson-1.2.0.tar.gz | 10.0 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| tree_sitter_hujson-1.2.0-cp310-abi3-win_amd64.whl | CPython 3.10 | abi3 | Windows x86-64 | Details |
| tree_sitter_hujson-1.2.0-cp310-abi3-win32.whl | CPython 3.10 | abi3 | Windows x86-32 | Details |
| tree_sitter_hujson-1.2.0-cp310-abi3-musllinux_1_2_x86_64.whl | CPython 3.10 | abi3 | Linux musl 1.2+ x86-64 | Details |
| tree_sitter_hujson-1.2.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl | CPython 3.10 | abi3 | Linux glibc 2.5+ x86-64, Linux glibc 2.28+ x86-64 | Details |
| tree_sitter_hujson-1.2.0-cp310-abi3-macosx_11_0_arm64.whl | CPython 3.10 | abi3 | macOS 11.0+ ARM64 | Details |
Total release size: 86.6 kB
Release files / tree_sitter_hujson-1.2.0.tar.gz
| Download URL | tree_sitter_hujson-1.2.0.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f2aefcdab5e8f061dc0700b85b52039eb95e3075be60d85569e207fb648c3818
|
|
BLAKE2b-256 checksum How to use checksums |
5e5dc08e5b69cd9dc5a7c10bb7987ea9a252b0c830515407144ff5ccf6fea0e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / tree_sitter_hujson-1.2.0-cp310-abi3-win_amd64.whl
| Download URL | tree_sitter_hujson-1.2.0-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 13.3 kB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
12476923eff17f477374df827c96906bf1fc361c0c12d77ee2b702d8f57d78f0
|
|
BLAKE2b-256 checksum How to use checksums |
e6638c210682a8881e678bfb9684e672e3da7f84a1f702f990870382a8ab59ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / tree_sitter_hujson-1.2.0-cp310-abi3-win32.whl
| Download URL | tree_sitter_hujson-1.2.0-cp310-abi3-win32.whl |
|---|---|
| Size | 13.2 kB |
| Tags | CPython 3.10 Windows x86-32 abi3 |
|
SHA-256 checksum How to use checksums |
1226e07caee681342cb4716494514b9fa8f419b7ec9fa5855d8296dd9506fb4c
|
|
BLAKE2b-256 checksum How to use checksums |
a1403e9e8529eff62f0c0b1c60aaa01f7027f3f913a910c659a009f6bd4d6a1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / tree_sitter_hujson-1.2.0-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | tree_sitter_hujson-1.2.0-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 19.1 kB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d110393fb2ac265f7abecfc07e782ec9142982e721be3c15b7173e30f2d7df7d
|
|
BLAKE2b-256 checksum How to use checksums |
e0375513abfbc4c4dcb2bd200c8495abb2a0ee4ff218ffee23f4d532922236bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / tree_sitter_hujson-1.2.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_hujson-1.2.0-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 19.2 kB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cd17accc343a2fc6d4414f29b775eb0b271f5681f71169cfb0c6f161bcb6bcff
|
|
BLAKE2b-256 checksum How to use checksums |
32f20bcde1ec75b9adf3cbdf27aa92e8fc2a0b2469a183b0aba7b27b9f0595a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency logRelease files / tree_sitter_hujson-1.2.0-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_hujson-1.2.0-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 11.8 kB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
1629bc03d00a50a5f38623afbd8b161836773fb0a7696511c46cc87bbebd9bab
|
|
BLAKE2b-256 checksum How to use checksums |
d5281f8edda2ad1f87ceae2658098bc008ed7a1756c1083b3dbc6bf5a618432f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.
Transparency log