How to format JSON in Notepad++?

beginer
beginer
Member
1328 Points
43 Posts

Raw string Json:

{ "myMenu" : { "id" : "file", "value" : "File", "popup" : { "menuitem" : [{ "value" : "New", "onclick" : "CreateNewDoc()" }, { "value" : "Open", "onclick" : "OpenDoc()" }, { "value" : "Close", "onclick" : "CloseDoc()" } ] } } }

I want to format string json formatting to tree structure json formatting in Notepad++. Something like:

{
  "myMenu" : {
    "id" : "file",
    "value" : "File",
    "popup" : {
      "menuitem" : [{
      "value" : "New",
          "onclick" : "CreateNewDoc()"
        }, {
          "value" : "Open",
          "onclick" : "OpenDoc()"
        }, {
          "value" : "Close",
          "onclick" : "CloseDoc()"
        }
      ]
    }
  }
}
Views: 13214
Total Answered: 2
Total Marked As Answer: 1
Posted On: 08-Jul-2020 23:24

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 Posts
         

You require a plugin to format JSON. For Notepad++ v.7.6 and above Plugins Admin... is available. And we can easily install plugin as follows:

  1. Open Menu Plugins > Plugins Admin...
  2. Search JSON Viewer and Check JSON Viewer in List
  3. Click on Install Button. It will restart Notepad++.


Now create new window and past your json string and follow following steps to format:

  1. Select JSON string text
  2. Go to Plugins > JSON Viewer > Format JSON ( Ctrl + Alt + Shift + M )
  3. Also, we can select json from Language menu for coloring and more


We can install any Notepad++ supported plugins using Plugins Admin...

Posted On: 11-Jul-2020 04:30
Fabio Rogerio Mamede
Fabio R...
Member
10 Points
0 Posts
         

Hey! thank you for explanation! It is helped me a lot!

Posted On: 12-Jul-2022 09:36
 Log In to Chat