mac sublime text3安装pretty json

1.首先在线安装Package Control插件

在线安装:打开sublime text ,点击菜单中的 “View”→“Show Console”(或快捷键 Ctrl + ` )打开命令行,把下面的代码粘贴进去后回车即可:

import urllib.request,os; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); open(os.path.join(ipp, pf), 'wb').write(urllib.request.urlopen( 'http://sublime.wbond.net/' + pf.replace(' ','%20')).read())

2.安装Rretty Json 

cmd + shift +p,输入"Package...."

选中“Package Control: Install Package”并回车,然后通过输入插件的名字pretty json找到插件并回车安装即可。

 

3.使用command + ctrl + j快捷键来格式化当前页面的内容

格式化之前

{"status":200,"data":{"pageInfo":{"current":1,"pageSize":5,"maxPage":1,"total":1},"list":[{"coreRefId":"1000147","positionUseRatio":"0.58","weightUseRatio":"-"}]}}

格式化之后

{
  "status": 200,
  "data": {
    "pageInfo": {
      "current": 1,
      "pageSize": 5,
      "maxPage": 1,
      "total": 1
    },
    "list": [
      {
        "coreRefId": "1000147",
        "positionUseRatio": "0.58",
        "weightUseRatio": "-"
      }
    ]
  }
}

 

你可能感兴趣的:(mac sublime text3安装pretty json)