Skip to content

douglasgusson/json-to-typescript-interfaces

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-to-typescript-interfaces

JSON converter for typescript interfaces

Demo in Text Pieces

Demo in Text Pieces (gif)

Developing

poetry shell

Install dependencies

poetry install

Executing

cat example.json | python json_to_ts/main.py
cat example.json | python json_to_ts/main.py 1 # 1 for camelCase in attributes

Input example

{
  "@id": 1,
    "abilities": [
      {
        "ability": {
          "name": "overgrow",
          "url": "https://pokeapi.co/api/v2/ability/65/"
        },
        "is_hidden": false,
        "slot": 1
      },
      {
        "ability": {
          "name": "chlorophyll",
          "url": "https://pokeapi.co/api/v2/ability/34/"
        },
        "is_hidden": true,
        "slot": 3
      }
    ],
    "base_experience": 64,

    ...

Output example

export interface Ability {
  name: string;
  url: string;
}

export interface Abilitie {
  ability: ability;
  isHidden: boolean;
  slot: number;
}

export interface Form {
  name: string;
  url: string;
}

...

Testing

pytest -v

About

JSON converter for Typescript Interfaces

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages