# json/no-unnormalized-keys

> Disallow JSON keys that are not normalized

Unicode has more than one way to write some characters. `é` is one character, U+00E9, or an `e` followed by the combining accent U+0301. The two look the same but are different keys, so a lookup with one doesn't find the other.

This rule reports keys that aren't in the chosen Unicode normalization form, which is NFC by default. `--fix` rewrites the key, unless it's written with escape sequences.

{/* 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-unnormalized-keys": "error" },
  },
];
```

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

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

## Examples

The `é` in this key is an `e` and a combining accent. Reported:

{/* bad */}

```json
{
  "café": 1
}
```

Here it's the single character. Not reported:

{/* good */}

```json
{
  "café": 1
}
```

## Options

{/* skip */}

```js eslint.config.js
export default [
  {
    rules: { "json/no-unnormalized-keys": ["error", { form: "NFD" }] },
  },
];
```

| Option | Default | What it does                                                        |
| ------ | ------- | ------------------------------------------------------------------- |
| `form` | `"NFC"` | The form that keys have to be in: `"NFC"`, `"NFD"`, `"NFKC"`, or `"NFKD"`. |

With `NFD`, it's the single character that's reported:

{/* bad {"options": [{"form": "NFD"}]} */}

```json
{
  "café": 1
}
```
