Code formatting tips (json, js)

Foreword

Usually we write business code, especially if others docking interface, often receive unformatted json. At this time, we have to visualize, you need to format it.

As the following code, formatted

{"a":"b","c":"d","e":[1,2,3,4,5]}

Becomes as follows

{
	"a": "b",
	"c": "d",
	"e": [1, 2, 3, 4, 5]
}

Positive articles

Method one: code formatting Online

There are many online sites online code formatting, you can format the code json, xml, css, etc., etc. format.

As online tools is a good website. Simply do not bother to use.

https://tool.oschina.net/codeformat/json

Second way: Notepad ++ plug-ins using jsTool

Notepad ++ is a very good notepad gadget, usually used to temporarily write something very practical. The Notepad ++ actually have a lot of useful plug-ins, one of which it is jsTool plug. After installation jsTool insert may simply press ctrl + alt + M code can be formatted.

The following shows the installation jsTool plug-in:

Open notepad ++, point Plugin -> Plugin Manager -> Search json -> find jsTool front of check -> upper right corner installation

Press after installation, a dialog box appears, press OK and the installation will automatically restart. After the automatic restart input string json code.

Then press ctrl + alt + M shortcut

You can see the code is formatted.

Further, jsTool js code format may be, for example:

ctrl + alt +M:

Finish

Guess you like

Origin blog.csdn.net/xiaohe73/article/details/93461479