An open API service indexing awesome lists of open source software.

https://github.com/destinio/make-types-rest

Convert JSON end-point to TypeScript Interfaces in the command line 🚀
https://github.com/destinio/make-types-rest

cli conversion json type

Last synced: about 1 month ago
JSON representation

Convert JSON end-point to TypeScript Interfaces in the command line 🚀

Awesome Lists containing this project

README

          

## MTR

## Convert JSON end-point to TypeScript Interface

`npx make-types-rest`

```sh
Usage
$ mtr --url
$ mtr --url --copy
$ mtr --url --root post

Options
--url, -u Url to be converted to Types
--root, -r Name of Interface default "RootObject"
--copy, -c Copy output to clipboard

Examples
$ mtr -u https://jsonplaceholder.typicode.com/posts --root post

interface Post {
userId: number;
id: number;
title: string;
body: string;
}
```

## Usage

### Install

`npm i -g make-types-rest`

### Run in command line

`make-types-rest -u https://jsonplaceholder.typicode.com/posts --root post`

or

`mtr -u https://jsonplaceholder.typicode.com/posts -r post -c`

### Output

```typescript
interface Post {
userId: number
id: number
title: string
body: string
}
```

## Creds

json-to-ts - https://www.npmjs.com/package/json-to-ts