Intentionally invalid sample JSON file
Last updated 2026-05-20
When to use this
Use this to verify your parser handles errors gracefully. The file mixes three common bugs — an unquoted key, a trailing comma, and a missing closing brace — so a strict parser will throw and a lenient one will fail informatively.
Verbatim contents (this will not parse)
{
"ok": true,
reason: "intentionally invalid",
"items": [1, 2, 3,],
"note": "this file is for parser error testing"
Full file is 123 B and 5 lines. Use Download for the complete payload.
Request examples
const fs = require('fs');
try {
JSON.parse(fs.readFileSync('./sample-invalid.json', 'utf8'));
} catch (err) {
console.error('parser error:', err.message);
}
import json
try:
with open('sample-invalid.json') as f:
json.load(f)
except json.JSONDecodeError as err:
print('parser error:', err)
curl -O https://jsonexamples.com/downloads/sample-invalid.json