ZIm/docs/src/languages/json.md
Thomas Zahner 38b8e6549f
ci: Check for broken links (#30844)
This PR fixes some broken links that where found using
[lychee](https://github.com/lycheeverse/lychee/) as discussed today with
@JosephTLyons and @nathansobo at the RustNL hackathon. Using
[lychee-action](https://github.com/lycheeverse/lychee-action/) we can
scan for broken links daily to prevent issues in the future.
There are still 6 broken links that I didn't know how to fix myself.
See https://github.com/thomas-zahner/zed/actions/runs/15075808232 for
details.

## Missing images

```
Errors in ./docs/src/channels.md

    [ERROR] file:///home/runner/work/zed/zed/docs/.gitbook/assets/channels-3.png | Cannot find file
    [ERROR] file:///home/runner/work/zed/zed/docs/.gitbook/assets/channels-1.png | Cannot find file
    [ERROR] file:///home/runner/work/zed/zed/docs/.gitbook/assets/channels-2.png | Cannot find file
```

These errors are showing up as missing images on
https://zed.dev/docs/channels
I tried to search the git history to see when or why they were deleted
but didn't find anything.

## ./crates/assistant_tools/src/edit_agent/evals/fixtures/zode/prompt.md

There are three errors in that file. I don't fully understand how these
issues were caused historically. Technically it would be possible to
ignore the files but of course if possible we should address the issues.
 
Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <git@maxdeviant.com>
Co-authored-by: Ben Kunkle <ben@zed.dev>
2025-06-06 09:39:35 +00:00

2.6 KiB

JSON

JSON support is available natively in Zed.

JSONC

Zed also supports a super-set of JSON called JSONC, which allows single line comments (//) in JSON files. While editing these files you can use cmd-/ (macOS) or ctrl-/ (Linux) to toggle comments on the current line or selection.

JSONC Prettier Formatting

If you use files with the *.jsonc extension when using Format Document or have format_on_save enabled, Zed invokes Prettier as the formatter. Prettier has an outstanding issue where it will add trailing commas to files with a jsonc extension. JSONC files which have a .json extension are unaffected.

To workaround this behavior you can add the following to your .prettierrc configuration file:

{
  "overrides": [
    {
      "files": ["*.jsonc"],
      "options": {
        "parser": "json",
        "trailingComma": "none"
      }
    }
  ]
}

JSON Language Server

Zed automatically out of the box supports JSON Schema validation of package.json and tsconfig.json files, but json-language-server can use JSON Schema definitions in project files, from the JSON Schema Store or other publicly available URLs for JSON validation.

Inline Schema Specification

To specify a schema inline with your JSON files, add a $schema top level key linking to your json schema file.

For example to for a .luarc.json for use with lua-language-server:

{
  "$schema": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json",
  "runtime.version": "Lua 5.4"
}

Schema Specification via Settings

You can alternatively associate JSON Schemas with file paths by via Zed LSP settings.

To

"lsp": {
  "json-language-server": {
    "settings": {
      "json": {
        "schemas": [
          {
            "fileMatch": ["*/*.luarc.json"],
            "url": "https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json"
          }
        ]
      }
    }
  }
}

You can also pass any of the supported settings to json-language-server by specifying them in your Zed settings.json: