JSON converter for typescript interfaces
poetry shell
poetry install
cat example.json | python json_to_ts/main.py
cat example.json | python json_to_ts/main.py 1 # 1 for camelCase in attributes
{
"@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,
...
export interface Ability {
name: string;
url: string;
}
export interface Abilitie {
ability: ability;
isHidden: boolean;
slot: number;
}
export interface Form {
name: string;
url: string;
}
...
pytest -v