HuJSON: JSON for Humans (JWCC: JSON w/ comments and trailing commas)
Go to file
2024-10-10 14:20:12 -07:00
.github/workflows Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
cmd/hujsonfmt feat(hujsonfmt): add basic hujsonfmt CLI command 2022-12-23 11:23:25 +00:00
find_test.go Add Value.Patch and Value.Find (#17) 2022-06-09 11:41:25 -07:00
find.go Add Value.Patch and Value.Find (#17) 2022-06-09 11:41:25 -07:00
format_test.go Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
format.go Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
fuzz_test.go Add Value.Patch and Value.Find (#17) 2022-06-09 11:41:25 -07:00
go.mod Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
go.sum Upgrade go-cmp@v0.5.8 (#19) 2022-04-26 16:20:23 -07:00
go.work Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
json_test.go Handle multi-byte runes for invalid character errors (#20) 2022-05-05 10:56:05 -07:00
LICENSE Delete fork of "encoding/json" (#21) 2022-05-06 14:30:45 -07:00
pack.go Initial commit of a HuJSON AST parser and packer 2021-08-18 10:52:15 -07:00
parse.go Handle multi-byte runes for invalid character errors (#20) 2022-05-05 10:56:05 -07:00
patch_test.go Add Value.Patch and Value.Find (#17) 2022-06-09 11:41:25 -07:00
patch.go Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
README.md Document Visual Studio Code support 2022-12-19 16:48:10 +00:00
standard.go Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
types_test.go Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00
types.go Add Value.All method to iterate over all values (#35) 2024-10-10 14:20:12 -07:00

HuJSON - "Human JSON" (JWCC)

The github.com/tailscale/hujson package implements the JWCC extension of standard JSON.

The JWCC format permits two things over standard JSON:

  1. C-style line comments and block comments intermixed with whitespace,
  2. allows trailing commas after the last member/element in an object/array.

All JSON is valid JWCC.

For details, see the JWCC docs at:

https://nigeltao.github.io/blog/2021/json-with-commas-comments.html

Visual Studio Code association

Visual Studio Code supports a similar jsonc (JSON with comments) format. To treat all *.hujson files as jsonc with trailing commas allowed, you can add the following snippet to your Visual Studio Code configuration:

"files.associations": {
    "*.hujson": "jsonc"
},
"json.schemas": [{
    "fileMatch": ["*.hujson"],
    "schema": {
        "allowTrailingCommas": true
    }
}]