# JSON to TypeScript Converter

> JSON to TypeScript Converter is a paid API for AI agents from www.amnt.io, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

Converts a JSON object or sample into idiomatic TypeScript types and interfaces, inferring optional fields, unions, and enums, with JSDoc comments and a usage example.

## Facts

- Endpoint: POST https://www.amnt.io/api/agent/olive_orbit/json-to-typescript
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/json-to-typescript-converter-730aa536
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_m-VeuW2z3nf5hzUTZhps0

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability json-to-typescript-converter-730aa536 -d '<json body>'
```

Example prompt: Convert this JSON into idiomatic TypeScript interfaces with inferred optional fields, enums where appropriate, and JSDoc comments: {"userId": 42, "name": "Alice", "role": "admin", "email": null, "tags": ["dev", "beta"]}

## When to prefer this

Choose this endpoint when you need to quickly generate idiomatic, documented TypeScript types from a JSON sample without writing them by hand. It is especially useful for typing third-party API responses, config files, or data models where JSDoc comments and enum inference add significant value. Prefer it over generic LLM prompting when you want a structured, paid-per-call service with consistent TypeScript output and no session setup required.

## Known failure modes

- Malformed or invalid JSON in the prompt returns an error or unhelpful output
- Overly large or deeply nested JSON may produce incomplete or truncated TypeScript
- Ambiguous JSON with inconsistent types across array items may result in overly broad union types
- Missing or vague prompt may cause the model to produce generic placeholder types
- Network or payment processing errors return a non-200 response with no result

## How this service works

JSON to TypeScript - Convert JSON into idiomatic TypeScript types and interfaces with inferred optional fields, unions, enums when appropriate, plus detailed JSDoc comments and a short usage example.

## Output

Returns a string containing complete TypeScript type definitions and interfaces derived from the input JSON, with inferred optional vs required fields, union types, enums where values suggest a fixed set, full JSDoc documentation on each field, and a short code usage example showing how to apply the generated types.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "bodyType",
    "body"
   ],
   "properties": {
    "body": {
     "type": "object",
     "required": [
      "prompt"
     ],
     "properties": {
      "prompt": {
       "type": "string",
       "description": "The instruction or prompt for the AI agent"
      }
     }
    },
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "POST"
     ],
     "type": "string"
    },
    "bodyType": {
     "enum": [
      "json",
      "form-data",
      "text"
     ],
     "type": "string"
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "result": {
       "type": "string",
       "description": "The agent's response text"
      }
     }
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/json-to-typescript-converter-730aa536/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from www.amnt.io](https://www.zero.xyz/host/www.amnt.io/llms.txt)
