# How to Find and Fix JSON Errors on Your Minecraft Server (/docs/minecraft/find-fix-json-errors)



import { Step, Steps } from 'fumadocs-ui/components/steps';

JSON is the format used by **Minecraft datapacks**, **resource packs**, the `whitelist.json` and `ops.json` files, many mod configs, and chat component formatting (tellraw, books, signs). Unlike YAML, JSON is whitespace-tolerant — but it's far stricter about commas, quotes, and brackets. A single missing comma will refuse to load the entire file.

The good news: every JSON error is mechanical. Five rules cover 95% of mistakes.

How JSON Errors Appear [#how-json-errors-appear]

In your Console:

```
[ERROR] com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException:
Unterminated object at line 12 column 5 path $.recipes[3].ingredients
```

The path tells you **exactly where**: `$.recipes[3].ingredients` means "in the `recipes` array, at index 3, in the `ingredients` field".

The Five Most Common JSON Mistakes [#the-five-most-common-json-mistakes]

<div className="fd-steps">
  <div className="fd-step">
    Trailing Commas (the #1 mistake) [#1-trailing-commas-the-1-mistake]

    JSON does **not** allow a comma after the last item in an object or array.

    ```json
    // WRONG
    {
      "name": "Steve",
      "age": 25,
    }

    // CORRECT
    {
      "name": "Steve",
      "age": 25
    }
    ```

    The same applies to arrays:

    ```json
    // WRONG
    ["a", "b", "c",]

    // CORRECT
    ["a", "b", "c"]
    ```
  </div>

  <div className="fd-step">
    Missing Quotes Around Keys [#2-missing-quotes-around-keys]

    In JSON, **all keys must be quoted** with double quotes.

    ```json
    // WRONG
    { name: "Steve" }

    // CORRECT
    { "name": "Steve" }
    ```

    This is different from JavaScript, where unquoted keys are allowed. JSON is strict.
  </div>

  <div className="fd-step">
    Single Quotes Instead of Double [#3-single-quotes-instead-of-double]

    JSON requires **double quotes** for both keys and string values. Single quotes are not allowed anywhere.

    ```json
    // WRONG
    { 'name': 'Steve' }

    // CORRECT
    { "name": "Steve" }
    ```
  </div>

  <div className="fd-step">
    Mismatched Brackets [#4-mismatched-brackets]

    Every `{` must have a `}`. Every `[` must have a `]`. Editors with bracket matching catch this immediately.

    ```json
    // WRONG (missing closing })
    {
      "settings": {
        "enabled": true
    }

    // CORRECT
    {
      "settings": {
        "enabled": true
      }
    }
    ```
  </div>

  <div className="fd-step">
    Comments [#5-comments]

    JSON does **not** support comments. No `//`, no `/* */`, no `#`.

    ```json
    // WRONG (// is not valid JSON)
    {
      "name": "Steve" // the player
    }

    // CORRECT (no comments)
    {
      "name": "Steve"
    }
    ```

    > **Workaround:** Some Minecraft files (like `pack.mcmeta`) tolerate `_comment` fields as a convention: `"_comment": "this is ignored by Minecraft"`.
  </div>
</div>

Fix It [#fix-it]

<Steps>
  <Step>
    Read the Console error [#read-the-console-error]

    In the [XGamingServer Panel](https://panel.xgamingserver.com), open **Console** and find the most recent `JsonSyntaxException` or `MalformedJsonException` message. Note the **file path**, **line**, and **column**.
  </Step>

  <Step>
    Open the file in the panel editor [#open-the-file-in-the-panel-editor]

    Click **Files** in the sidebar. Navigate to the file from the error and open it.
  </Step>

  <Step>
    Validate the file online [#validate-the-file-online]

    Copy the entire file content. Paste it into [jsonlint.com](https://jsonlint.com/) and click **Validate**. JSONLint highlights every error with line and column.
  </Step>

  <Step>
    Fix the file [#fix-the-file]

    Apply the fixes from the five rules above. Most fixes are:

    * Remove trailing comma
    * Add missing comma between items
    * Quote a key
    * Replace single quotes with double quotes
    * Add the missing `}` or `]`
  </Step>

  <Step>
    Save and reload [#save-and-reload]

    Click **Save Content**. Then:

    * **Datapack**: run `/reload` in-game
    * **Resource pack**: players need to reload the pack (F3+T or rejoin)
    * **Mod config**: restart the server
  </Step>
</Steps>

Where Minecraft Uses JSON [#where-minecraft-uses-json]

| File / location                                                        | What it does              |
| ---------------------------------------------------------------------- | ------------------------- |
| `whitelist.json`, `ops.json`, `banned-players.json`, `banned-ips.json` | Server-level player lists |
| `world/datapacks/<name>/data/.../recipes/*.json`                       | Custom recipes            |
| `world/datapacks/<name>/data/.../loot_tables/*.json`                   | Custom loot tables        |
| `world/datapacks/<name>/data/.../advancements/*.json`                  | Custom advancements       |
| `world/datapacks/<name>/pack.mcmeta`                                   | Datapack metadata         |
| `resourcepack/.../assets/.../models/*.json`                            | Custom model definitions  |
| `resourcepack/pack.mcmeta`                                             | Resource pack metadata    |
| `tellraw @a {"text":"hi"}`                                             | In-game chat components   |
| Mod configs (some mods)                                                | Configuration files       |

Tips for Editing JSON [#tips-for-editing-json]

| Tip                                                     | Why                                                                      |
| ------------------------------------------------------- | ------------------------------------------------------------------------ |
| Use VS Code with the JSON extension                     | Highlights errors live as you type                                       |
| Use [jsonlint.com](https://jsonlint.com/) before saving | Catches issues before upload                                             |
| **Pretty-format** your JSON (2-space indent)            | Makes mismatches visible                                                 |
| Use a JSON formatter to fix layout                      | [jsonformatter.org](https://jsonformatter.org/) cleans up minified files |
| Validate datapacks with `/datapack list`                | Server reports broken packs after `/reload`                              |
| Test small datapacks first                              | Easier to find errors in 10 lines than 1000                              |

Common Mistakes [#common-mistakes]

| Mistake                                       | Fix                                                         |
| --------------------------------------------- | ----------------------------------------------------------- |
| Pasting JSON from a website with smart quotes | Replace `"` and `'` with plain `"`                          |
| Comma after the last item                     | Remove it                                                   |
| Trying to add `// comments`                   | JSON has no comments — remove them                          |
| Single quotes around strings                  | Use double quotes                                           |
| Numbers with leading zeros (e.g., `007`)      | JSON forbids leading zeros — use `7`                        |
| Trailing whitespace inside the file           | Should be fine, but some parsers complain                   |
| File saved as UTF-8 with BOM                  | Save as plain UTF-8 — BOM breaks Minecraft datapack parsing |

Specific Cases [#specific-cases]

Datapack Recipes [#datapack-recipes]

If a recipe fails to load, run `/datapack list` to see the broken pack. Re-validate `pack.mcmeta` and the offending recipe file.

Resource Pack Models [#resource-pack-models]

Custom models are very picky. A missing comma breaks the model entirely — the player sees a missing texture cube.

tellraw and Sign Books [#tellraw-and-sign-books]

These are JSON in chat. Use a generator like [minecraft.tools/en/tellraw.php](https://minecraft.tools/en/tellraw.php) to avoid hand-writing them.

Related Guides [#related-guides]

* [Find / Fix YAML Errors](/docs/minecraft/find-fix-yaml-errors)
* [Manage Datapacks](/docs/minecraft/manage-datapacks)
* [Server Won't Start](/docs/minecraft/fix-server-wont-start)
* [Common Issues](/docs/minecraft/common-issues)
