Skip to content

Ganesan-Chandran/vscode-json-utility

Repository files navigation

JSON Utility

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

json-utility Screenshot

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

json-utility Screenshot

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

json-utility Screenshot

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

json-utility Screenshot

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

json-utility Screenshot

⚙️ 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.

json-utility Screenshot

📝 Changelog

See the release notes for the full set of changes.

✒️ Author

Ganesan Chandran

📜 License

See the license details.

👍 Contribution

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