# JSON import

No agent connected? Ask any LLM to convert your question paper into this JSON,
then paste it in **Question bank → Import JSON** (or POST it to
`/api/tests/bank/import`).

## The prompt that works

> Convert this question paper into JSON matching the schema below. One object
> per question. Give every question a topic and difficulty. Use option ids
> a, b, c, d. Put the correct answers in answer_spec. Reply with ONLY the JSON.

## Schema

```json
{
  "questions": [
    {
      "type": "mcq_single",
      "answer_spec": { "correct": ["b"] },
      "topic": "physics",
      "subtopic": "kinematics",
      "difficulty": "easy",
      "tags": ["neet"],
      "client_ref": "paper1-q1",
      "translations": [
        {
          "lang": "en",
          "body": "Acceleration due to gravity near Earth?",
          "options": [
            { "id": "a", "text": "8.9 m/s²" },
            { "id": "b", "text": "9.8 m/s²" }
          ]
        },
        {
          "lang": "hi",
          "body": "पृथ्वी के निकट गुरुत्वीय त्वरण?",
          "options": [
            { "id": "a", "text": "8.9 m/s²" },
            { "id": "b", "text": "9.8 m/s²" }
          ]
        }
      ]
    }
  ]
}
```

## answer_spec by type

| type | answer_spec |
| --- | --- |
| `mcq_single` | `{"correct":["b"]}` — exactly one id |
| `mcq_multi` | `{"correct":["a","c"]}` — every correct id |
| `integer` | `{"value": 42}` |
| `numeric` | `{"value": 9.8, "tolerance": 0.1}` |
| `true_false` | `{"value": true}` |
| `fill_blank` | `{"accepted": ["Delhi"]}` (or per-language `fill_accepted`) |
| `long_answer` | `{"rubric": "what earns marks — only you see this"}` |

A `numeric` question can also list **several acceptable answers or ranges** —
real answer keys need this ("9 or 6 both correct", "anything from 0.30 to 0.33"):

```json
{ "accepted_values": [ { "value": 9 }, { "value": 6 } ] }
{ "accepted_values": [ { "min": 0.30, "max": 0.33 } ] }
```

## Math and diagrams in question text

Question bodies and option texts render **LaTeX math**: `$...$` inline,
`$$...$$` on its own line. Write `\$` for a literal dollar sign.

```text
The value of $\int_0^1 x^2\,dx$ is $$\frac{1}{3}$$
```

Diagrams: upload the image first (`POST /api/tests/bank/assets`, or the
`upload_asset` MCP tool), then reference the returned URL from the body with
`![caption](/api/tests/asset/<id>/<sha>)`. Only Amatya asset URLs render —
external image URLs stay as plain text by design.

Rules the importer enforces: option **ids must match across languages** (that
is what lets a Hindi answer grade identically to an English one), `correct`
ids must exist in the options, and `client_ref` makes re-imports idempotent.
The import report tells you per question what happened — read it.
