Lint and Cleanup
JSON Lint Error Guide
Fix JSON lint errors around trailing commas, invalid quotes, comments, escaping, arrays and object shape before API debugging. This reference is written for developers who need practical validation behavior, reviewable rules and safe examples rather than copied snippets with no explanation.
Recommended workflow
| Step | Why it matters |
|---|---|
| Fix syntax first | A parser error is different from an API contract error. |
| Look for JavaScript habits | Single quotes, comments and trailing commas are not valid JSON. |
| Check escaping | Newlines, quotes and backslashes inside strings need careful handling. |
| Validate shape second | After parsing, compare required fields, types and arrays against the API contract. |
Starter snippet
JSON.parse(payload)
# Fix the first syntax error, then validate shape separately.Review checks
- Use double quotes for keys and strings.
- Remove trailing commas before sending payloads.
- Keep examples tiny and synthetic.
- Separate parse errors from schema errors in UI messages.
Common mistakes
- Calling a JavaScript object literal JSON.
- Pasting secrets into public formatters.
- Trying to debug server validation before the payload parses.
Validation should help users correct input while protecting systems from bad data. Keep syntax checks, product policy, security review and deliverability checks separate.
Related Formalint references
Continue with Json Formatting Guide, Json Schema Guide, Api Request Body Validation Guide.