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.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/lxgicstudios/type-genJSON to TypeScript
Generate TypeScript interfaces from JSON. Stop writing types by hand.
Installation
npm install -g @lxgicstudios/json-to-ts
Commands
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.ts
Example
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 |
Features
- Nested objects become separate interfaces
- Arrays properly typed
- Mixed arrays become union types
- Fetches directly from URLs
- Handles empty arrays as
unknown[]
Common Use Cases
Type an API response:
curl https://api.github.com/users/octocat | npx @lxgicstudios/json-to-ts -n GitHubUser
Generate types for project:
npx @lxgicstudios/json-to-ts sample-response.json -o src/types/api.ts -n ApiResponse
Built by LXGIC Studios
Metadata
Not sure this is the right skill?
Describe what you want to build โ we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-lxgicstudios-type-gen": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
script-gen
Generate package.json scripts with AI. Use when setting up npm scripts.
email-template-gen
Generate responsive email templates. Use when building transactional emails.
branch-namer
Generate descriptive git branch names from plain English. Use when you need a branch name that follows conventions.
cloudflare-gen
Generate Cloudflare Workers configuration and code. Use when building on the edge.
adr-writer
Generate Architecture Decision Records with AI. Use when documenting technical decisions.