Reputation: 23546
I need Notepad++ to take a json string from this
{"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}}
to this...
{"menu": {
"id": "file",
"value": "File",
"popup": {
"menuitem": [
{"value": "New", "onclick": "CreateNewDoc()"},
{"value": "Open", "onclick": "OpenDoc()"},
{"value": "Close", "onclick": "CloseDoc()"}
]
}
}}
I looked around at all the TextFX options but couldn't find anything that worked.
Upvotes: 1414
Views: 1741288
Reputation: 17422
Add the JSON Viewer Plugin
Open Notepad++, go to Plugins, click "Plugins Admin..."
In the Plugins Admin window, search for JSON Viewer and click on Install
Now after installing the plugin, this is how you can view file in JSON format
Upvotes: 46
Reputation: 3061
Notepad++ requires a plugin to format JSON. You can use the JSON Viewer plugin to do this. To install the plugin, do the following steps:
Upvotes: 251
Reputation: 3802
You can use JSON Viewer. For Notepad++ v.7.6+, Plugins Admin... is available to install it:
Upvotes: 318
Reputation: 18714
As of Notepad++ v7.6, you can use the Plugin Admin option in Notepad++ to install JSTool.
Here's an example of JSON that's been formatted using the tool:
{
"menu" : {
"id" : "file",
"value" : "File",
"popup" : {
"menuitem" : [{
"value" : "New",
"onclick" : "CreateNewDoc()"
}, {
"value" : "Open",
"onclick" : "OpenDoc()"
}, {
"value" : "Close",
"onclick" : "CloseDoc()"
}
]
}
}
}
Tip: Select the code you want to reformat, then Plugins | JSTool | JSFormat.
Upvotes: 1809
Reputation: 7454
I didn't have the Plugins Admin option, so the easiest way was to reinstall Notepad++ first (I was using v8.5.8) and select:
(Also I simply reinstalled Notepad++ over the top of the previous install, I didn't uninstall first.)
In Notepad++ I then went to Plugins → Plugins Admin and searched for the plugins I wanted:
I ticked them both then clicked Install.
Upvotes: 5
Reputation: 2413
you can use Notepad++ to format Json using Plugin Admin and JSTool but for those who can't install this plugin they can use Postman to Beautify json like this:
Upvotes: 9
Reputation: 613
Steps to add JSON viewer plugin for notepad++:
Upvotes: 12
Reputation: 5767
I use 32-bit Notepad++ version 7.5.6. I have found that 32-bit JSToolNpp 1.20.0
does a great job.
The direct link is:
https://sourceforge.net/projects/jsminnpp/files/Uni/JSToolNPP.1.2006.0.uni.32.zip/download
which is redirected from https://sourceforge.net/projects/jsminnpp/.
VirusTotal link:
https://www.virustotal.com/gui/file/008ee0ce889dfd9e96b975cebe6faafe28bc350352e951f3dec97e8e5bec5a07
JSON-Viewer works fine too, but cannot sort the JSON data.
Upvotes: 4
Reputation: 334
For those of us behind a corporate firewall with no direct access to the internet, using the Plugins Admin won't work. To use the JSMinNpp plugin, you can't just "copy the dll to the plugins folder". It needs to live inside a folder called "JSMinNpp" inside the plugins folder. After doing that and restarting Notepad++, I was able to see the "JSTool" menu option under the Plugins menu.
Tested with Notepad++ 7.8.2 and 7.8.9.
Upvotes: 2
Reputation: 81
You can view in Notepad++ no problem now (maybe older versions were bugged?)
for win64: You can find the latest plugin here: https://github.com/kapilratnani/JSON-Viewer/releases . The latest zip file contains a .dll file.
And then follow the github priject README instructions:
- Paste the file "NPPJSONViewer.dll" to Notepad++ plugin folder
- open a document containing a JSON string
- Select JSON fragment and navigate to plugins/JSON Viewer/show JSON Viewer or press "Ctrl+Alt+Shift+J"
- Voila!! if the JSON is valid, it will be shown in a Treeview
It should be the same process for win32 but I cannot personally verify it.
Upvotes: 5
Reputation: 439
simply go to this link
download the dll
copy and paste the dll to the plugins folder at notepad++, \Notepad++\plugins
restart the notepad++, and it should be shown in the list
NOTE: this dll supports 64 bit notepade++
Upvotes: 10
Reputation: 1379
If you don't want to install a Notepad++ plugin but you have Firefox and a JSON plugin for Firefox, you can select Run -> Launch in Firefox
. You get the contents formatted as JSON using your Firefox plugin.
This is what I personally do.
Upvotes: 4
Reputation: 77993
Universal Indent GUI plugin for Notepad++ will turn your sample into:
{
"menu" : {
"id" : "file", "value" : "File", "popup" : {
"menuitem" : [ {
"value" : "New", "onclick" : "CreateNewDoc()";
}
, {
"value" : "Open", "onclick" : "OpenDoc()";
}
, {
"value" : "Close", "onclick" : "CloseDoc()";
}
];
}
}
}
Upvotes: 44
Reputation: 557
I know this thread is old but I recently ran into a problem with JSToolNPP not being compatible with my newly updated N++, I did find a replacement that seems to work. http://sourceforge.net/projects/nppjsonviewer/
Use at your own risk, ofc. (standard disclaimer from me when linking anything outside the SExchange, fyi)
Upvotes: 3
Reputation: 1178
I'm using the JSON Viewer plug-in with NPP 5.9 and it seems to work well.
Upvotes: 3
Reputation: 103
Notepad 5.8.7 and jsmin 1.7.0.0 works wonderful here.
Be careful though, found out jsmin eats the comments the hard way (should have read first).
Upvotes: 3
Reputation: 79
JSMinNpp plugin will do this job. https://sourceforge.net/projects/jsminnpp/
Upvotes: 7
Reputation: 742
It's not an NPP solution, but in a pinch, you can use this online JSON Formatter and then just paste the formatted text into NPP and then select Javascript as the language.
Upvotes: 7
Reputation: 45
It worked for me in the latest edition to Notepad using the UniversalIndentGui.
What I did was under the plugin setting choose Enable Text Auto Update, a window popped up and I selected javascript.
Upvotes: 3