# JSON to TypeScript Interface Converter

> JSON to TypeScript Interface Converter is a paid API for AI agents from api.strale.io, paid per call via x402, $0.054001/call, status unknown (last checked 2026-10-09).

Converts a JSON object or string into TypeScript interfaces, handling nested objects, arrays, optional fields, date strings, and UUIDs.

## Facts

- Endpoint: GET https://api.strale.io/x402/json-to-typescript?utm_source=zero.xyz
- Price: $0.054001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-09
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-strale-io-3f486fee
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_F8rwn9pSdEe1aCJMoRfxZ

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 api-strale-io-3f486fee
```

Example prompt: Can you convert this JSON into TypeScript interfaces for me: {"user":{"id":"550e8400-e29b-41d4-a716-446655440000","name":"Alice","createdAt":"2024-01-15T10:00:00Z","address":{"city":"Berlin","zip":"10115"}}} — name the root interface 'User' and include export keywords.

## When to prefer this

Choose this endpoint when you need fast, algorithmic TypeScript interface generation from a JSON payload without sending data to an LLM. It is ideal for typed API client generation, auto-documenting REST response shapes, or scaffolding TypeScript models from sample data. Prefer it over LLM-based approaches when consistency, speed, and determinism matter.

## Known failure modes

- Invalid or malformed JSON input returns an error
- Missing required 'json' query parameter returns a 400-level error
- Extremely deeply nested or circular JSON structures may produce incomplete output
- Non-JSON string passed as input fails to parse

## How this service works

Convert JSON to TypeScript interfaces. Handles nested objects, arrays, optional fields. Detects date strings and UUIDs. Algorithmic.

## Output

Returns TypeScript interface declarations for the provided JSON, with nested object types, arrays typed appropriately, optional fields marked with '?', date strings inferred as Date types, and UUIDs noted. If 'export' is requested, interfaces are prefixed with the export keyword. The root interface uses the supplied root_name or a default name.

## Example request

```json
{
 "json": "{\"user\":{\"id\":\"550e8400-e29b-41d4-a716-446655440000\",\"name\":\"Alice\",\"createdAt\":\"2024-01-15T10:00:00Z\",\"address\":{\"city\":\"Berlin\",\"zip\":\"10115\"}}}",
 "export": true,
 "root_name": "User"
}
```

## 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"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "json"
     ],
     "properties": {
      "json": {
       "description": "JSON string or object"
      },
      "export": {
       "type": "boolean"
      },
      "root_name": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-strale-io-3f486fee/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
