## TL;DR
JSON does not allow trailing commas, so one stray comma after the last element (often left by an edit or a generator) makes the whole .ipynb unparseable. Open the file, find the comma before a `]` or `}`, delete it, and validate with `python -c "import nbformat; nbformat.read('nb.ipynb',4)"`. Then stop hand-editing JSON: use nbformat for programmatic changes so the serializer handles the commas.

```text
notebook json parser failed on a trailing comma, json decode error
```

## Use this when
- The .ipynb fails to parse with a JSONDecodeError pointing near a `]` or `}`.
- The file was hand-edited or generated by string templating.
- The error message says 'Expecting property name' or similar.

## Not for this skill when
- The JSON parses but validation fails. That is a schema issue.
- Python code has a trailing comma. Python allows those; this is about JSON.

## Steps
1. Read the JSONDecodeError location (line and column). Verify: you know where the parser choked.
2. Look just before that position for a comma followed by `]` or `}`. Verify: you see the trailing comma.
3. Delete the comma. Verify: the file parses with nbformat.read.
4. Search the file for other trailing commas. Verify: none remain.
5. Switch programmatic edits to nbformat read/modify/write. Verify: the generator cannot produce this again.

## Variant phrasings
### trailing comma ipynb json error
Short form. Delete it; JSON forbids them.

### notebook won't parse jsondecodeerror
The error phrasing. Check near brackets.

### json trailing comma notebook
General phrasing. Use nbformat for edits.

Compatibility: JSON spec, all nbformat versions. The rule is in the format, not the tool.

## Why it happens
Python and JavaScript tolerate trailing commas, so authors and generators produce them by habit, but JSON's grammar forbids them and Python's json module enforces the grammar strictly. The .ipynb is JSON, not Python, so the file that looks fine to a Python-trained eye is unparseable. Generators that build JSON by string concatenation are the usual source.

## Edge cases / pitfalls
- There is often more than one trailing comma. Search the whole file, not just the first error.
- Some editors auto-add trailing commas in JSONC mode. Save as plain JSON.
- A linter or `python -m json.tool` on the file catches these instantly. Run it after hand edits.
- If the file came from a generator, fix the generator. The comma will be back next run.

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_KSREZDV9_LOW3j2TtP2Qyw
