I need Notepad++ to take a json string from this
{\"menu\": {\"id\": \"file\",\"value\": \"File\",\"popup\": {\"menuitem\": [{\"value\": \"New\", \"onclick\"
The following Notepad++ plugin worked for me as suggested by "SUN" https://sourceforge.net/projects/jsminnpp/
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.
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).
Your best bet is to use one of the latest versions of Eclipse (I am using Eclipse Galileo J2EE and Eclipse Ganymede J2EE). Create a JavaScript file, then create a variable:
var jsonObject = {"menu": {"id": "file","value": "File","popup": {"menuitem": [{"value": "New", "onclick": "CreateNewDoc()"},{"value": "Open", "onclick": "OpenDoc()"},{"value": "Close", "onclick": "CloseDoc()"}]}}};
Lastly, hit CTRL+SHIFT+F and voila! You have a nicely indented JSON Object. I, too, am looking for a Notepad++ JSON formatter, and I very well may be forced to develop an Npp plugin some short time in the future.
Update:
As of Notepad++ v7.6, use Plugin Admin to install JSTool per this answer
INSTALL
Download it from http://sourceforge.net/projects/jsminnpp/ and copy JSMinNpp.dll to plugin directory of Notepad++. Or you can just install "JSTool" from Plugin Manager in Notepad++.
New Notepad++ install and where did PluginManager go? See How to view Plugin Manager in Notepad++
{
"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.
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()";
}
];
}
}
}