in the Zed Editor
A community extension for highlighting, built-in JSONC for comments, and a manual formatter setup.
Zed's documentation covers JSON and JSONC, not JSON5. For .json5 files there is a community extension named JSON5 that adds a language and a Tree-sitter grammar. It provides highlighting, bracket matching, indentation and an outline, and the extension's files define no language server and no formatter.
So the working setup has three parts: install the extension, map any other file names with the file_types setting, and point an external formatter such as Prettier at the buffer if you want formatting. I ran all three in Zed 1.30.2 on Windows 11 on 12-01-2026 with extension 0.1.1 and Prettier 3.10.1; the results are in each section below, next to what the documentation says.
TL;DR: Install the JSON5 extension (version 0.1.1, grammar from the tree-sitter-json5 project) from the Zed extensions page. It covers highlighting and editing helpers only. Zed's own docs describe JSON and JSONC; JSONC allows // comments. For formatting, configure an external command in your settings. Tested in Zed 1.30.2 on 12-01-2026: without the extension a .json5 file opens as "Unknown" with no colors; with it, the file is highlighted, file_types mapping works, and Prettier formats on save.
The Community JSON5 Extension
The Zed extensions page lists one extension named JSON5. These are the facts I read from the listing and from its source repository:
| Item | Value |
|---|---|
| Author | Chunzheng Wang (community, not part of Zed) |
| Version | 0.1.1 |
| Last updated | 07-17-2026 on the extensions page; the changelog dates 0.1.1 as 07-16-2026 |
| Description | "JSON5 language support for Zed using Joakker's Tree-sitter grammar." |
| Grammar | The tree-sitter-json5 project, pinned by commit in extension.toml |
| Provides | Languages and Grammars (per the extensions page) |
| License | The extensions page does not state one; the repository contains a LICENSE file I did not open |
The repository has an extension.toml with one grammar entry and a languages/json5 folder. The folder holds a config.toml and query files for brackets, highlights, indents, injections, outline, overrides, redactions and text objects. There is no language server entry and no formatter entry in extension.toml.
What the source says it does
The README lists syntax highlighting for comments, trailing commas, single-quoted strings, unquoted keys and hexadecimal numbers. The 0.1.1 changelog adds bracket matching, automatic indentation, a document outline, Vim comment text objects and collaboration redactions. The language config sets the .json5 file extension, // line comments, /* */ block comments and a tab size of 2.
Tested in Zed 1.30.2
- Without the extension: a
.json5file opened with the language shown as "Unknown" in the status bar and no highlighting. Zed showed a prompt: "Do you want to install the recommended 'json5' extension for 'json5' files?" - With extension 0.1.1: the status bar read "JSON5". Comments, unquoted keys, single-quoted and double-quoted strings were each colored, and
0xFF,.5,5.,+1,InfinityandNaNwere colored as numbers. Trailing commas and a string continued with a backslash drew no error marks. - Installing it: on my machine Zed's own download of the extension failed, and its log said "failed to iterate over archive: Invalid gzip header". The same archive downloaded fine outside Zed, so I unpacked it into Zed's
extensions/installed/json5folder by hand and Zed loaded it on the next start. I do not know whether that failure is specific to my network. - A new folder: Zed opened my test folder in Restricted Mode and asked me to trust it first. Restricted Mode keeps project settings and language servers off.
Nothing in the extension's files reports syntax errors to you. To check a file, validate with the online validator or the CLI.
Zed's Built-in JSON and JSONC
Zed's JSON page has headings for JSON, JSONC, JSONC Prettier formatting and the JSON language server. It does not mention JSON5. What it says about JSONC:
- "Zed also supports a super-set of JSON called JSONC, which allows single line comments (
//) in JSON files." - Toggle comments with Cmd+/ on macOS or Ctrl+/ on Linux.
- Prettier "has an outstanding issue where it will add trailing commas to files with a
jsoncextension." JSONC files with a.jsonextension are unaffected, and the docs give a.prettierrcworkaround.
The same page covers the JSON language server: Zed supports JSON Schema validation of package.json and tsconfig.json out of the box, an inline $schema key links a schema to a file, and schemas can be associated with file paths in the language server settings. Paths starting with ./ resolve against the worktree root.
The docs I read do not say that the JSON or JSONC language accepts unquoted keys, single-quoted strings or trailing commas, and they do not say that the JSON language server attaches to .json5 files. I leave those out. The practical point: JSONC gives you comments only, and the JSON5 extension is the one built for the rest of the syntax.
Tip: if all you need is comments in a config file, JSONC is the documented route. For the full JSON5 feature set see the comments in JSON guide and the syntax reference.
Associating File Types
Zed's docs describe the file_types setting as the way to "configure how Zed selects a language for a file based on its filename or extension." It maps a language name to extensions or filename patterns, and it supports glob entries. The docs' own example maps .c files to C++:
"file_types": {
"C++": ["c"],
"TOML": ["MyLockFile"],
"Dockerfile": ["Dockerfile*"]
} The same pattern works for JSON5 files that do not end in .json5. Use the language name that the extension registers, which is JSON5 in its config. I tested this entry in Zed 1.30.2: with it in my settings, a file named app.conf opened with "JSON5" in the status bar and full highlighting:
"file_types": {
"JSON5": ["*.settings", "app.conf"]
} Open your settings with the zed: open settings command, which the docs name, and add the entry at the top level. The docs also show that Zed's own default file_types maps its config files, **/{zed,Zed}/{settings,keymap,tasks,debug}.json, to the JSONC language.
Formatting With Prettier
The docs state that "Zed supports both built-in and external formatters." Their configuration example runs Prettier as an external command for JavaScript and turns on format-on-save:
"languages": {
"JavaScript": {
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--stdin-filepath", "{buffer_path}"]
}
},
"format_on_save": "on"
}
}What the docs state, and what they do not:
- External command formatters "do not support range formatting and are skipped when formatting selections."
format_on_saveis "Whether to automatically format code when saving," and can be set per language to"on"or"off".- The settings reference says the default
languagessettings enable Prettier for languages such as JavaScript, TypeScript, CSS, JSON and Markdown, and it has aprettierobject with anallowedoption. - The pages I read do not list JSON5 among those defaults, and they do not say whether Prettier ships with Zed or needs Node.js. For the test below I installed Prettier myself with npm.
So for a .json5 file the route is the external formatter form above, set under the JSON5 language name. I tested this block in Zed 1.30.2 with Prettier 3.10.1:
"languages": {
"JSON5": {
"formatter": {
"external": {
"command": "prettier",
"arguments": ["--parser", "json5", "--stdin-filepath", "{buffer_path}"]
}
},
"format_on_save": "on"
}
}- Saving a
.json5file with Ctrl+S ran Prettier and rewrote the file. Both comments were kept. - Keys stayed unquoted, quoted keys lost their quotes, single quotes became double quotes,
0xFFbecame0xff,.5became0.5,5.became5, and+1,InfinityandNaNwere left alone. Trailing commas inside one-line arrays and objects were removed. --parser json5matters for mapped names. Without it, savingapp.conffailed with Prettier's error "No parser could be inferred for file", Zed showed "Formatting failed" in the status bar, and the file was saved unformatted. With it, the same file formatted. A.json5file formatted either way.- On Windows I gave
commandthe full path toprettier.cmdinside a localnode_modules/.binfolder. I did not test a bareprettieron the PATH.
What Prettier itself does to a JSON5 file, and which options keep comments, is covered in the formatting guide.
Zed's Own Settings Are JSON With Comments
The configuration docs show Zed's settings, keymap, tasks and debug files being assigned to the JSONC language by default, through the file_types glob quoted above. Their examples also carry // comments inside JSON blocks. That makes Zed one more tool whose own config files are the kind of file this site is about. Project settings live in .zed/settings.json.
The docs I read do not say whether trailing commas are accepted in those files, so keep them out of your settings.
Step by Step
- Install the extension. Find JSON5 in Zed's extensions list (the page is zed.dev/extensions/json5) and install it.
- Open a
.json5file. The extension README says.json5files activate it automatically. - Map other names with
file_typesif you keep JSON5 under other extensions. - Install Prettier yourself (
npm install --global prettier) if you want the external formatter, then add the formatter block for theJSON5language. - Validate separately. The extension does not report syntax errors, so run
json5 --validate file.json5or paste the file into the validator.
FAQ
Does Zed support JSON5 out of the box?
No. In Zed 1.30.2 a .json5 file opened as "Unknown" with no highlighting, and Zed offered to install the community JSON5 extension. Zed's JSON documentation covers JSON and JSONC only.
Does the extension include a language server?
No. The installed 0.1.1 package holds an extension.toml with one grammar and an empty language server list, a grammar file and query files. There is no formatter or validator in it.
Can I just use JSONC for my JSON5 file?
JSONC covers // comments per Zed's docs. It is not documented to cover unquoted keys or single-quoted strings, so use the extension for those.
Is the extension maintained?
The listing shows version 0.1.1 updated 07-17-2026, and the changelog has entries dated 09-21-2025 and 07-16-2026. It is a small community project, so check its repository before depending on it.
Why do Zed's own settings allow comments?
Zed's default file_types assigns its settings, keymap, tasks and debug files to the JSONC language.
Sources
(8)
- Zed extensions: JSON5
- json5-zed-extension repository and README (GitHub)
- json5-zed-extension: extension.toml (GitHub)
- json5-zed-extension: CHANGELOG.md (GitHub)
- Zed documentation: JSON and JSONC
- Zed documentation: Configuring languages (file_types, formatters)
- Zed documentation: Configuring Zed (settings, Prettier, default file_types)
- tree-sitter-json5 grammar (GitHub)
Last reviewed: 12-01-2026.
Need a Quick Check Instead?
Paste a file into the browser validator, or read the syntax reference.
JavaScript
Python
TypeScript
Node.js
Rust
Java
C#
Ruby
Kotlin
Lua
Babel
Vite
webpack
ESLint
Prettier
VS Code
JetBrains