{"id":27013975,"url":"https://github.com/krikera/json-typescript","last_synced_at":"2026-02-22T20:39:57.514Z","repository":{"id":285927123,"uuid":"959799495","full_name":"krikera/json-typescript","owner":"krikera","description":"CLI tool to convert JSON structures into TypeScript interfaces and classes with automatic type detection","archived":false,"fork":false,"pushed_at":"2025-04-03T11:38:26.000Z","size":48,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-15T18:23:11.316Z","etag":null,"topics":["cli","converter","interfaces","json-to-typescript","nodejs","type-generation","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/json-to-ts-cvr","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/krikera.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-03T11:23:25.000Z","updated_at":"2025-04-03T11:38:30.000Z","dependencies_parsed_at":"2025-04-09T17:42:01.222Z","dependency_job_id":null,"html_url":"https://github.com/krikera/json-typescript","commit_stats":null,"previous_names":["krikera/json-typescript"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/krikera/json-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krikera%2Fjson-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krikera%2Fjson-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krikera%2Fjson-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krikera%2Fjson-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/krikera","download_url":"https://codeload.github.com/krikera/json-typescript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/krikera%2Fjson-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29726345,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","converter","interfaces","json-to-typescript","nodejs","type-generation","typescript"],"created_at":"2025-04-04T13:19:21.540Z","updated_at":"2026-02-22T20:39:57.505Z","avatar_url":"https://github.com/krikera.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# json-to-ts-cvr\n\n[![npm version](https://img.shields.io/npm/v/json-to-ts-cvr.svg)](https://www.npmjs.com/package/json-to-ts-cvr)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![CI](https://github.com/krikera/json-typescript/actions/workflows/ci.yml/badge.svg)](https://github.com/krikera/json-typescript/actions/workflows/ci.yml)\n\n\u003e A CLI tool to convert JSON structures into TypeScript interfaces or classes\n\n## Installation\n\n```bash\n# Install globally\nnpm install -g json-to-ts-cvr\n\n# Or use with npx\nnpx json-to-ts-cvr [options]\n```\n\n## Features\n\n- Convert JSON to TypeScript interfaces or classes\n- Support for nested objects and arrays\n- Generate proper type definitions (string, number, boolean, etc.)\n- Auto-generate interface names from property names\n- Customize interface/class names with prefixes\n- Handle nullable fields\n\n## Usage\n\n### Convert JSON string to TypeScript interface\n\n```bash\njson-to-ts-cvr '{\"name\": \"John\", \"age\": 25}'\n```\n\nOutput:\n```typescript\ninterface Root {\n  name: string;\n  age: number;\n}\n```\n\n### Convert JSON from a file and save to a TypeScript file\n\n```bash\njson-to-ts-cvr -i data.json -o types.ts\n```\n\n### Generate TypeScript classes instead of interfaces\n\n```bash\njson-to-ts-cvr -i data.json --class\n```\n\nOutput:\n```typescript\nclass Root {\n  name: string;\n  age: number;\n\n  constructor(data: any) {\n    this.name = data.name;\n    this.age = data.age;\n  }\n}\n```\n\n### Add a prefix to all interface/class names\n\n```bash\njson-to-ts-cvr -i data.json --prefix I\n```\n\nOutput:\n```typescript\ninterface IRoot {\n  name: string;\n  age: number;\n}\n```\n\n### Handle null values as union types\n\n```bash\njson-to-ts-cvr -i data.json --union-null\n```\n\nOutput:\n```typescript\ninterface Root {\n  name: string;\n  nickname: null;\n}\n```\n\n## Options\n\n| Option | Alias | Description |\n|--------|-------|-------------|\n| `--input \u003cfile\u003e` | `-i` | Input JSON file path |\n| `--output \u003cfile\u003e` | `-o` | Output TypeScript file path |\n| `--class` | | Generate TypeScript classes instead of interfaces |\n| `--union-null` | | Represent nullable fields as union types (field: string \\| null) |\n| `--prefix \u003cprefix\u003e` | | Prepend a custom prefix to all interface/class names |\n| `--help` | `-h` | Display help information |\n| `--version` | `-v` | Display version information |\n\n## Examples\n\n### Complex nested objects\n\nInput:\n```json\n{\n  \"user\": {\n    \"name\": \"John\",\n    \"address\": {\n      \"city\": \"New York\",\n      \"zipCode\": 10001\n    },\n    \"hobbies\": [\"reading\", \"gaming\"]\n  }\n}\n```\n\nOutput:\n```typescript\ninterface Root {\n  user: User;\n}\n\ninterface User {\n  name: string;\n  address: Address;\n  hobbies: string[];\n}\n\ninterface Address {\n  city: string;\n  zipCode: number;\n}\n```\n\n## Development\n\n```bash\n# Clone the repository\ngit clone https://github.com/krikera/json-typescript.git\ncd json-typescript\n\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n# Run tests\nnpm test\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## Publishing\n\nTo publish to npm:\n\n```bash\n# Login to npm\nnpm login\n\n# Publish package\nnpm publish\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrikera%2Fjson-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkrikera%2Fjson-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkrikera%2Fjson-typescript/lists"}