SaitechAI Training Note: JSON Validator Case Study

NEET–JEE Mock Test JSON Template • Common Errors • Fix Strategy • Practice Validator

1) The NEET–JEE Mock Test JSON Template (Mandatory Structure)

Valid JSON only No comments No trailing commas LaTeX required for symbols
{
  "title": "Your Test Title",
  "time_minutes": 180,
  "questions": [
    {
      "id": 1,
      "text": "Question text with LaTeX like \\(x^2+y^2=r^2\\)",
      "options": [
        "Option A",
        "Option B",
        "Option C",
        "Option D"
      ],
      "correct_index": 0
    }
  ]
}

Notes: correct_index is 0-based (0,1,2,3). Use double backslashes for LaTeX inside JSON strings.

2) Case Study: Why “Invalid JSON syntax” Happened

A) JSON does NOT allow comments

Invalid Fix
// Physics Section
{
  "id": 1,
  "text": "..."
}
{
  "id": 1,
  "text": "..."
}

B) Trailing commas break JSON

{
  "options": ["A", "B", "C", "D",]
}
{
  "options": ["A", "B", "C", "D"]
}

C) LaTeX backslashes must be escaped

{
  "text": "If \(P(A)=0.4\), find \(P(A|B)\)"
}
{
  "text": "If \\(P(A)=0.4\\), find \\(P(A|B)\\)"
}

D) Hidden characters from Word/Docs

  • Smart quotes, non-breaking spaces, zero-width characters may confuse strict parsers.
  • Write JSON in a code editor (VS Code) and validate with JSONLint.

3) Best Tools (Field Tested)

Recommended Editor

  • VS Code (real-time validation, line/column errors, safe for big files)
  • Enable: Format on Save and use Prettier

Recommended Validator

  • JSONLint (strict validation; excellent for final check)
  • jsonformatter (format + validate + locate errors)

Do NOT use for final JSON

  • Word / Google Docs
  • Plain Notepad (no validation)

4) SaitechAI Checklist Before Upload

  • Template keys present: title, time_minutes, questions
  • Every question has: id, text, options, correct_index
  • options has exactly 4 items
  • correct_index is 0–3
  • All maths/science symbols in LaTeX with double backslashes
  • No trailing commas, no comments

5) Practice: Built-in JSON Validator (Offline, No Internet)

Paste your JSON below and click Validate. This tool checks: JSON validity, required keys, options length, and correct_index range.

Result will appear here.
Tip: For LaTeX, always use double slashes like \\(x^2\\).

6) What We Improved (From Failure to Success)