Google

May 9, 2013

Notepad++ plugin for viewing JSON data and other benefits

Q. Why is Notepad++ is a very handy tool?
A.  Notepad++ is a very handy developer tool. Here are some of the productivity benefits of Notepad++.

  •  to view source code as a free and light weight source code editor that runs in Windows environment. You can also use it to view log files and other text data.
  • It can be used for syntax highlighting, line numbering, search and replace with or without regular expressions, modified file detection, file search, etc. 

Working with JSON data

Recently, I had to work a lot with JSON data, and stumbled across a very handy plugin for Notepadd++ called "JSONViewer Notepad++", which allows you to format JSON data and view them as a tree structure. Here are the simple setps to install this plugin.

Step 1: Download the plugin as a zip file from the source-forge site.

Step 2: Unzip the downloaded file and extract out the "NPPJSONViewer.dll" file.

Step 3: Copy this file to the plugins folder in your Notepad++ installation folder, and restart your Notepad++. for example "c:\myapps\Notepad++\5.9\plugins".

Step 4: When you open up your Notepad++, you will see the "JSONViewer" sub menu under the "Plugins" on the top main menu. You can format the JSON text by highlighting your text first and then clicking on Plugins --> JSON Viewer --> Format JSON.


Extracting data

If you had some tab limited data like

FirstName Surname Age
John  Smith 25
Peter  Warren 35
Lisa  Jenkins 28


and if you want to extract out all the first names, you can invoke the column mode by pressing "Alt" key and then select the "FirstName" column with the mouse selection. Alternatively, you can use the "Alt+Shift+Arrow Key" to select the column entries you need. These options are under the  "Edit --> Column Mode" on the top menu.

Finding and replacing values with Regular expressions

If you have some comma delimited data as shown below

FirstName,Surname,middlename
John,Smith 
Peter,Warren,James 
Lisa,Jenkins


where the middle name is optional, and you want to convert the comma delimited data to tab delimited data.This is where Notepad++ 's regex based find and replace comes in handy.

Step 1: Select "Search --> Find" from the top menu.
Step 2: click on "Replace" tab.
Step 3: Tick "Match case" if required and select "Regular Expression" option.
Step 4: Enter the relevant  regular expressionsfor the "Find What" and "Replace With".


Find What: ([A-Z][a-z]*),([A-Z][a-z]*)(.*)
Replace With: \1\t\2\t\3

Where \1, etc are groups and \t is for tab delimiting.




You can use the "Find In files" tab to replace multiple files. I use this feature to search for files that has certain text (i.e. grep). This is a bulk find and replace capability. It also has other bulk features like "File --> Save all" open files.


Split views, file comparisons and synchronized scrolling

Select  View -->  Move/Clone Current Document to create split views to compare two files side by side. On split views you can select Plugins --> Compare --> compare to highlight the differences or select View --> Synchronize Vertical Scrolling to scroll both views in tandem.


Language feature to highlight reserved key words

Setting the language of the file like Java, JavaScript, etc via Language --> J --> Java or JavaScript will help you easily visually distinguish between functions, reserved words, comments, text, and other types of symbols and expressions in your code.


The latest Notepad++ version should have a TextFx menu to tidy up HTML tags to be XHTML compliant. You can also automate any monotonous tasks you do repeatedly with the Macros. It can also synchronize files with  Subversion (i.e. SVN). Hence Notepad++ is a powerful open-source developer tool that makes you more productive.

Labels: ,

1 Comments:

Blogger Unknown said...

you can use java notepad plugin

java notepad plugin download

1:49 AM, March 24, 2014  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home