JSON Utility is VSCode extension which is helps to
Convert TypeScript Interface to JSON Sample
JSON to TypeScript Interface
Fix the JSON Object
Beautify the JSON String (Prettify & Minify)
📦 Install
Install via VSCode Extensions
Open VSCode Extensions panel using Cmd+Shift+X shortcut.
Type JSON Utility in Search bar.
Select the JSON Utility and install the extension.
💡 Features
1) Convert TypeScript Interface to JSON Sample (Ctrl + Alt + J)
Select the TypeScript Interface from the file (If you didn't select it then JSON Utility takes the full content in the file as input)
Run the extension using any one of the option in below.
Use the Command Palette (Cmd+Shift+P) -> Type JSON Utility -> Select JSON Utility: Convert Interface to JSON Sample
Use the shortcut Ctrl + Alt + J
2) Convert JSON to TypeScript Interface (Ctrl + Alt + T)
Select the JSON from the file (If you didn't select it then JSON Utility takes the full content in the file as input)
Run the extension using any one of the option in below.
Use the Command Palette (Cmd+Shift+P) -> Type JSON Utility -> Select JSON Utility: Convert JSON to Interface
Use the shortcut Ctrl + Alt + T
3) Fix the JSON Object (Ctrl + Alt + F)
Select the JSON from the file (If you didn't select it then JSON Utility takes the full content in the file as input)
Run the extension using any one of the option in below.
Use the Command Palette (Cmd+Shift+P) -> Type JSON Utility -> Select JSON Utility: Fix the JSON
Use the shortcut Ctrl + Alt + F
4) Beautify the JSON String (Prettify: Ctrl + Alt + P , Minify: Ctrl + Alt + M)
1. Prettify the JSON
Select the JSON from the file (If you didn't select it then JSON Utility takes the full content in the file as input)
Run the extension using any one of the option in below.
Use the Command Palette (Cmd+Shift+P) -> Type JSON Utility -> Select JSON Utility: Prettify the JSON.
Use the shortcut Ctrl + Alt + P
2. Minify the JSON
Select the JSON from the file (If you didn't select it then JSON Utility takes the full content in the file as input)
Run the extension using any one of the option in below.
Use the Command Palette (Cmd+Shift+P) -> Type JSON Utility -> Select JSON Utility: Minify the JSON
Use the shortcut Ctrl + Alt + M
⚙️ Configuration
JSON Utility has few configurations. If you want to change the default configuration, select the required option.
Name
Setting
Default
Description
Output
json-utility.output
New Window
Either open the result in new window or same input file
Type In UnionTypes
json-utility.typeInUnionTypes
Random Type
Which type needs to select in the union types for JSON output? Example: interface Test { name : (string \| number \| boolean) } Here the name property can have string or number or boolean type. In the JSON output, the value of name property should be belongs to which type. The type will be picked randomly from these three types. You can change to First Type(Here string) as default for JSON output.
Feel free to submit a pull request if you find any bugs (To see a list of active issues, visit the Issues section). Please make sure all commits are properly documented.
Icons
Icons Credit : document icons PNG Designed By IYIKON from pngtree