1

I'm looking for a simple tool to do a simple thing: convert a JSON object to a typescript type or interface.

For instance given one of these: https://api.github.com/users/octocat

I'd like to copy and paste that into the tool and get a structure like this:

export interface GitProfile {
  login: string;
  id: number;
  avatar_url: string;
  gravatar_id: string;
  url: string;
  html_url: string;
  followers_url: string;
  following_url: string;
  gists_url: string;
  ...other_parts: part_types;...
}

This seems pretty straight forward so I'm crossing my fingers someone already made the tool and I just can't find it. Tempted to make one myself, though I'm a pretty novice programmer and it might take time.

1 Answer 1

3

Indeed someone has : https://www.npmjs.com/package/json2dts

And I also have IDE support for it in alm.tools

https://basarat.gitbooks.io/alm/content/features/json-to-dts.html

Sign up to request clarification or add additional context in comments.

2 Comments

Cool! That is an awesome project.
The web tool is absurdly perfect! I'm not sure I'll want to install a package for it since it's something I'd only use every so often, but would save me countless hours in the long run!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.