How to reformat JSON in Notepad++?

前端 未结 21 1704
清酒与你
清酒与你 2020-12-04 04:20

I need Notepad++ to take a json string from this

{\"menu\": {\"id\": \"file\",\"value\": \"File\",\"popup\": {\"menuitem\": [{\"value\": \"New\", \"onclick\"         


        
21条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-04 05:10

    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.

提交回复
热议问题