> ## Documentation Index
> Fetch the complete documentation index at: https://docs.context.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Setting up Context.dev for a user? Follow https://docs.context.dev/agent-quickstart.md. MCP clients sign in with OAuth and need no API key; application code reads CONTEXT_DEV_API_KEY.

# JSON

> Extract page facts into an object that follows your JSON Schema.

Enable `formats.json` and provide `jsonParams.schema`. An AI model reads the page’s Markdown and returns an object in `json.data`.

## Define the object

Send this body to `POST /web/scrape`. See the [Quickstart](/quickstart) for authentication and SDK setup.

```json theme={null}
{
  "url": "https://example.com",
  "formats": {
    "json": true
  },
  "jsonParams": {
    "schema": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "contact_email": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "title",
        "contact_email"
      ]
    },
    "instructions": "Use only facts stated on the page."
  }
}
```

Abridged response:

```json theme={null}
{"json":{"requested":true,"success":true,"data":{"title":"Example Domain","contact_email":null}}}
```

## Design for missing facts

Use optional or nullable fields for facts a page might omit. Required, non-nullable fields receive a best-effort value and can introduce guesses. Review extracted values before using them for consequential decisions.

The schema must describe a top-level object. Wrap a list in an object property:

```json theme={null}
{"type":"object","properties":{"products":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"}}}}}}
```

Zod users can pass `z.toJSONSchema()` output. `jsonParams.instructions` can specify which facts to prioritize or how to interpret fields.

## Choose an extraction method

| Need                                      | Use                                  |
| ----------------------------------------- | ------------------------------------ |
| Known CSS selectors and exact page values | [Parse fields](/scrape/parse-fields) |
| Interpret one page into a custom schema   | JSON                                 |
| Standard product details                  | [Product](/scrape/product)           |
| Research across the web                   | [Answers](/answers/overview)         |

## Limits

Schemas are limited to 50 KB when serialized; instructions to 2,000 characters. Extraction reads the first 100,000 characters of Markdown after [content filtering](/scrape/content-filtering). A page with no text returns `{}`. A failed or timed-out extraction has `success: false` and `data: null`.
