Sublime Text 格式化JSON-pretty json

Sublime Text3格式化JSON

一、安装Install Package

点击菜单中的 “View”–“ShowConsole”(快捷键 Ctrl+ `)调出Console。然后把下面的代码粘贴进去后回车即可,需稍微等待一段时间。

注:若失效,请以官网https://packagecontrol.io/installation#st2代码为准。)

SublimeText3

importurllib.request,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' +'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp= sublime.installed_packages_path(); urllib.request.install_opener(urllib.request.build_opener( urllib.request.ProxyHandler()) ); by =urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ','%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validatingdownload (got %s instead of %s), please try manual install' % (dh, h)) if dh !=h else open(os.path.join( ipp, pf), 'wb' ).write(by)

sublimetext2

importurllib2,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' +'ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp= sublime.installed_packages_path(); os.makedirs( ipp ) if notos.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener(urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' +pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open(os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Errorvalidating download (got %s instead of %s), please try manual install' % (dh,h) if dh != h else 'Please restart Sublime Text to finish installation')

 输入后,按回车键,稍等片刻,重启sublime text;

二、安装pretty json

快捷键ctrl+shift+p,打开面板,输入pci,选中“PackageControl: Install Package”并回车,然后通过输入插件的名字pretty json找到插件并回车安装即可。

三、使用ctrl+alt+j格式化json数据;

第三步:使用ctrl+ alt+ j快捷键来格式化当前页面的内容。


参考地址:http://blog.csdn.net/u010412719/article/details/77435104

原文地址:https://www.cnblogs.com/jpfss/p/10214247.html