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.
JSON is a plain text file that can be opened in a text editor. You can easily modify and save it back without any special software.
Notepad++ has limited support for the validation of JSOn content. JSON formatter gives an error or warning during the format of an opened json file. You can also check JSON viewer to check for invalid json content.
You can format your JSON document using Ctrl+Shift+I or Format Document from the context menu.
To format and indent the code: select all the json fragment. click "Plugins"/"JSON Viewer"/"Format JSON" or use the shortcut Ctrl + Alt + Shift + M.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With