The JSON to TypeScript extension for Visual Studio Code allows you to quickly convert JSON content from your clipboard into TypeScript type declarations. This tool is particularly useful for developers who frequently work with JSON data and need to generate TypeScript interfaces to type-check their data structures.
Features
Convert JSON from clipboard to TypeScript interfaces.
Customizable root interface name.
Accessible via command palette, context menu, and keyboard shortcuts.
Installation
Open Visual Studio Code.
Go to the Extensions view by clicking the Extensions icon in the Activity Bar on the side of the window or by pressing Ctrl+Shift+X.
Search for "JSON to TypeScript".
Click Install to install the extension.
Usage
Via Command Palette
Copy the JSON content you want to convert to your clipboard.
Open the Command Palette by pressing Ctrl+Shift+P (Windows/Linux) or Cmd+Shift+P (macOS).
Type Convert JSON to TypeScript and select the command.
Enter the desired name for the root interface when prompted.
The generated TypeScript interfaces will be inserted at the current cursor position in the active editor.
Via Context Menu
Copy the JSON content you want to convert to your clipboard.
Right-click in the active editor to open the context menu.
Select Convert JSON to TypeScript.
Enter the desired name for the root interface when prompted.
The generated TypeScript interfaces will be inserted at the current cursor position.
Via Keyboard Shortcut
Copy the JSON content you want to convert to your clipboard.
Press the following keyboard shortcut:
Windows/Linux: Ctrl+Alt+J
macOS: Cmd+Alt+J
Enter the desired name for the root interface when prompted.
The generated TypeScript interfaces will be inserted at the current cursor position in the active editor.
Configuration
No additional configuration is required. The extension is ready to use out of the box.
Contributing
If you have any suggestions, bug reports, or contributions, feel free to open an issue or submit a pull request on the GitHub repository.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Credits
This extension was built using the json-to-ts library.
Release Notes
0.0.1
Initial release of JSON to TypeScript.
Supports conversion of JSON from clipboard to TypeScript interfaces.
Customizable root interface name.
Accessible via command palette, context menu, and keyboard shortcuts.