In the last article, we discussed the JSON plugin for Notepad++ which is very useful to format JSON. There is another plugin JSTool – A JavaScript tool for Notepad++ which provides the same functionality. It is actually a Javascript plugin that works on JSON as well.
So let’s discuss this plugin in detail and see how to install and use it.
JSTool – A JavaScript tool for Notepad++
JSToolNpp is a Javascript Plugin for Notepad++ to minimize and format JavaScript code. You can also use it to view JSON as Tree, Format, and Sort. It is available for Both 32-bit and 64-bit Notepad++.
You can download the source code and plugin dll file from the links given below.
Install JSTool in Notepad++
Plugin Admin or Plugin Manager is the best and easy way to install this plugin. Open Notepad++ and Go to Plugins–>Plugins Admin. Search and select the JSTool plugin and click the install button to install the plugin in Notepad++.
This is a really easy method, but many a time this may install an outdated version of the plugin. If that is the case, you can manually install the plugin using the method given below.
Manual Installation Steps,
- Open Notepad++.
- Go to Plugins–> Open Plugins Folder…menu.
- Create a folder JSMinNpp.
- Download JSTool Plugin.
- Extract and copy JSMinNpp.dll to the JSMinNPP folder.
- Restart Notepadd++
That’s it. You have successfully installed the plugin.
The plugin should be available under plugin Menu in the toolbar as shown in the below image.
Using JSTool Plugin
Now let’s see how to use this Javascript plugin.
Minimize JavaScript
Open JavaScript file in Notepad++. Then, Go to Plugins->JSTool->JSMin. This removes all the blank spaces to compress JavaScript.
The JSMin(New File) option compress and open the minimized file in the new editor window.
Before Min
<script type="text/javascript"> alert("Hello, World "); </script>
After Min
<script type="text/javascript">alert("Hello, World ");</script>
Format JavaScript
Open JavaScript file in Notepad++. Then, Go to Plugins->JSTool->JSFormat. This should format the JavaScript, but it is not working for me. Seems some issue with the plugin.
Before format
<script type="text/javascript">alert("Hello, World ");</script>
After format
< script type = "text/javascript" > alert("Hello, World "); < / script >
JSON Viewer
This option opens a frame on the right-hand side which shows JSON as a tree. You can even select the individual nodes and the plugin highlights the same in the Notepad++ editor. This functionality was not available in JSON Viewer Plugins.
<Img>
JSON Sort
Open JSON file in Notepad++. Then, Go to Plugins->JSTool->JSFormat. This options format the JSON in same windows while JSFOAMT (new open) open a new window.
Before Sort
{ "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": { "GlossEntry": { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": { "para": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML"] }, "GlossSee": "markup" } } } } }
After Sort
{ "glossary": { "GlossDiv": { "GlossList": { "GlossEntry": { "Abbrev": "ISO 8879:1986", "Acronym": "SGML", "GlossDef": { "GlossSeeAlso": ["GML", "XML"], "para": "A meta-markup language, used to create markup languages such as DocBook." }, "GlossSee": "markup", "GlossTerm": "Standard Generalized Markup Language", "ID": "SGML", "SortAs": "SGML" } }, "title": "S" }, "title": "example glossary" } }
Summary
Javascript does not work the way it should, but you can use this JSTool plugin to Minimize Javascript and work on JSON.
I hope you found this article useful. Please share and subscribe.