Basic information
About json-to-typescript-interface-generator
Generate TypeScript interfaces from JSON data or API responses. Auto-type your APIs instantly. Free CLI tool for TypeScript developers.
json-to-typescript-interface-generator is an agent skill listed in the AddMCP.net directory, published by openclaw. Source code is hosted on github.com.
Overview
What is json-to-typescript-interface-generator?
name: JSON to TypeScript - Interface Generator description: Generate TypeScript interfaces from JSON data or API responses. Auto-type your APIs instantly. Free CLI tool for TypeScript developers.
JSON to TypeScript
Generate TypeScript interfaces from JSON. Stop writing types by hand.
What it does
- Nested objects become separate interfaces
- Arrays properly typed
- Mixed arrays become union types
- Fetches directly from URLs
- Handles empty arrays as
unknown[]
Installation
npm install -g @lxgicstudios/json-to-tsCommands
From File
npx @lxgicstudios/json-to-ts data.json
npx @lxgicstudios/json-to-ts response.json -n User
From URL
npx @lxgicstudios/json-to-ts https://api.example.com/users -n User
From Pipe
curl https://api.example.com/data | npx @lxgicstudios/json-to-ts -n ApiResponse
Output to File
npx @lxgicstudios/json-to-ts api.json -o src/types/api.tsExample
Input JSON:
{
"id": 1,
"name": "John",
"email": "[email protected]",
"address": { "city": "NYC" },
"tags": ["dev", "ts"]
}
Output:
export interface Address {
city: string;
}
export interface Root {
id: number;
name: string;
email: string;
address: Address;
tags: string[];
}Options
| Option | Description | |--------|-------------| | -n, --name | Root interface name (default: Root) | | -o, --output | Write to file | | -t, --type | Use type instead of interface | | --optional | Make all properties optional | | --no-export | Don't add export keyword |
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In