Skip to content
BEAD

JSON → TypeScript

Turn any JSON sample into TypeScript interfaces — handles nested objects, arrays of varying shape, and optional fields.

TypeScript
interface Specs {
  weight_g: number;
  battery_hours: number;
}

interface Review {
  user: string;
  stars: number;
  comment?: string;
}

interface Root {
  id: number;
  name: string;
  active: boolean;
  tags: string[];
  specs: Specs;
  reviews: Review[];
  discontinued: null;
}

🔒 Type inference runs entirely in your browser.

</>Use this tool programmaticallycurl · JavaScript · MCP

Same tool, callable from any HTTP client or from Claude (via MCP). Anonymous: 100 req/day per IP. Sign up for 1,000 req/day.

curl
curl https://api.b-e-a-d.com/tools/json-to-ts/run \
  -H "Content-Type: application/json" \
  -d '{
  "input": "your input here",
  "rootName": "Root",
  "useType": false,
  "readonly": false
}'
JavaScript (fetch)
const res = await fetch("https://api.b-e-a-d.com/tools/json-to-ts/run", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
  "input": "your input here",
  "rootName": "Root",
  "useType": false,
  "readonly": false
}),
});
const data = await res.json();
console.log(data.result);
MCP (Claude Desktop / Claude Code)
# In Claude Desktop / Claude Code, add to your MCP config:
{
  "mcpServers": {
    "bead": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://mcp.b-e-a-d.com"]
    }
  }
}

# Then ask Claude to call:
mcp__bead__bead_json_to_ts

Full reference: developer docs · OpenAPI spec

How inference works

  • Objects become named interfaces, lifted out and named after the field they came from (so a user field yields a User interface).
  • Arrays of objects are merged into a single shape — fields missing from any element become optional.
  • Arrays of mixed primitives become a union ((string | number)[]).
  • Empty arrays become unknown[]; null values widen the field type with | null.

Always sanity-check the output for very dynamic JSON — a single sample can't reveal every possibility.

You might also like