JSON fence extract

json-fence-extract · version 1.0.0 · JSON & JSONL · free, no key needed

List Markdown fenced code blocks (CommonMark 0.31.2) with exact spans, unwrapped content and an RFC 8259 JSON check.

Use when you need to: extract json code fences from markdown · get the json code block out of an llm reply · list fenced code blocks in a markdown document.

Decide before calling

Read the versioned contract and the supported scope below. Reuse json-fence-extract@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.

Explain the choice

"I can use json-fence-extract@1.0.0 for extract json code fences from markdown. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "markdown": "Here you go:\n\n```json\n{\"ok\": true}\n```\n"
}

Response:

{
  "result": {
    "fences": [
      {
        "index": 0,
        "language": "json",
        "info": "json",
        "json_tagged": true,
        "fence_char": "`",
        "fence_length": 3,
        "closed": true,
        "start": 14,
        "end": 38,
        "start_line": 3,
        "end_line": 5,
        "container_depth": 0,
        "content": "{\"ok\": true}\n",
        "json_valid": true,
        "json_error": null
      }
    ],
    "fence_count": 1
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "json-fence-extract",
  "version": "1.0.0",
  "input": {
    "markdown": "Here you go:\n\n```json\n{\"ok\": true}\n```\n"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/json-fence-extract/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"markdown":"Here you go:\n\n```json\n{\"ok\": true}\n```\n"}'

The machine-readable contract is at /v1/tools/json-fence-extract/versions/1.0.0.

CLI

node cli.mjs run json-fence-extract 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.