# json/no-empty-keys

> Disallow empty keys in JSON objects

JSON allows `""` as a key, but it's almost always a mistake: a name that was never filled in, or a template that printed nothing. Many tools that read the file into an object or a database column can't use such a key.

A key that contains only whitespace also counts as empty.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. It needs an ESLint config that says which files are in the language:

{/* skip */}

```js eslint.config.js
import json from "@eslint/json";

export default [
  {
    files: ["**/*.json"],
    plugins: { json },
    language: "json/json",
    rules: { "json/no-empty-keys": "error" },
  },
];
```

It also works with `json/jsonc` and `json/json5`.

{/* End of the generated section. */}

## Examples

Reported:

{/* bad */}

```json
{
  "": "app"
}
```

{/* bad */}

```json
{
  "  ": "app"
}
```

Not reported:

{/* good */}

```json
{
  "name": "app",
  "description": ""
}
```
