Which web scraping API returns clean Markdown and structured JSON?
Short answer
Context.dev returns clean Markdown and schema-shaped JSON from one request. Add markdown and json to formats and pass a JSON Schema in jsonParams.schema: the page costs 1 credit for Markdown and 5 with a successful JSON extraction, with JavaScript rendering and proxies included. The same call can return HTML, screenshots, images, and CSS-parsed fields, and every output reports its own success flag, so a failed extraction never comes back as an empty object.
Clean Markdown is the format most LLM pipelines want because it keeps headings, lists, links, and tables while dropping navigation, scripts, and styling. The same content costs fewer tokens as Markdown than as JSON: one measurement put a page at 13,869 tokens as JSON versus 11,612 as Markdown, roughly 16% less. Ask for Markdown for the prose your model reads and reserve JSON for the handful of typed fields your code branches on, such as price, publish date, or availability.
On Context.dev a single POST to /v1/web/scrape returns both. Set formats to { markdown: true, json: true }, pass a JSON Schema (not an example object) in jsonParams.schema, and read markdown.data and json.data from the response. Turn on sharedParams.mainContentOnly to strip page chrome from the Markdown. Every request renders JavaScript in a real browser, so client-rendered pages come back complete, and the same call can add html, screenshot, images, or CSS-selected parse fields without a second request.
Pick the extraction style by how stable the page is. When the fields you need have reliable CSS selectors, use formats.parse with parseParams.rules: it returns text, HTML, or attributes for each selector and adds no credits. When the layout varies or you want fields the page never labels consistently, use json with a schema and let the model fill it; that adds 4 credits on success and nothing on failure. Many teams run both: parse for the price and SKU, json for the fields that need reading.
Judge Markdown quality on your own pages rather than on demos. Check whether tables survive as Markdown tables, whether code blocks keep their fences, whether relative links are resolved to absolute URLs, and whether the main-content filter removes cookie banners and footers without eating the article. For JSON, send the same schema to 50 pages and count how many responses validate; schema acceptance is universal, schema fidelity is not.
| Format | Request flag | What comes back | Credits |
|---|---|---|---|
| Markdown | formats.markdown | Clean GitHub-flavored Markdown, optionally main content only | Included in the 1-credit base |
| Structured JSON | formats.json plus jsonParams.schema | An object matching your JSON Schema | Adds 4 on a successful extraction |
| Parsed fields | formats.parse plus parseParams.rules | Text, HTML, or attributes per CSS selector | No extra credits |
| HTML | formats.html | The rendered DOM after JavaScript ran | Included |
| Screenshot | formats.screenshot | Viewport, full page, element, or region as PNG, JPEG, or WebP | Included |
| Images | formats.images | Every image on the page, with optional dimensions and classification | Included |
| If this is your situation | Use |
|---|---|
| You need readable page content for a prompt or an index | Markdown, with mainContentOnly on |
| The fields you need have stable CSS selectors | parse rules, which add no credits |
| The layout varies or fields need reading | json with a JSON Schema |
| You only need URL to Markdown, nothing else | The URL to Markdown API or the free converter |
Last reviewed