Invalid JSON File
Download a free invalid JSON file designed to test how your application handles malformed JSON input. This file contains intentional JSON syntax errors that are commonly encountered in real-world development — trailing commas, unquoted keys, single-quoted strings, and inline comments. Use it to verify that your JSON parser fails gracefully, returns meaningful error messages, and does not crash or expose sensitive information.
What Is Broken
This file contains multiple intentional JSON specification violations: trailing commas after the last element in arrays and objects, single-quoted strings instead of required double quotes, JavaScript-style comments (// and /* */), unquoted property keys, NaN and Infinity literal values, and hexadecimal number notation. Each of these is valid in JavaScript but violates the JSON specification (RFC 8259).
Broken Example
{
// This is an invalid JSON file
'name': 'Alice',
"age": 30,
"tags": ["developer", "writer",],
"score": NaN,
"hex": 0xFF,
}Why It Matters
Malformed JSON is one of the most common causes of API failures, data pipeline crashes, and frontend rendering bugs. Testing with intentionally broken JSON ensures your application provides clear error messages, maintains data integrity, and does not expose stack traces or internal details to end users.
Expected Parser / Validator Behavior
JSON.parse() should throw SyntaxError with a descriptive message and position indicator. Python json.loads() should raise json.decoder.JSONDecodeError. Java Jackson should throw JsonParseException. Well-behaved applications should return a 400 Bad Request with a user-friendly error message.
Related Invalid Files
Related Validators & Tools
Valid Sample Files
Frequently Asked Questions
What makes this JSON invalid?
It violates RFC 8259 with trailing commas, single quotes, comments, NaN values, and hex notation — all valid in JavaScript but illegal in JSON.
How should my app handle invalid JSON?
Catch the parse error, log it for debugging, and return a clear 400 response to the client with a description of what went wrong. Never expose raw stack traces.
Is there a valid version available?
Yes. Download the valid counterpart file alongside the invalid one to test both success and failure paths.