How to fix JSON indentation in vim?

前端 未结 8 1326
粉色の甜心
粉色の甜心 2020-12-29 03:55

In vim, the default indentation for JSON is:

{
    \"employees\": [
    { \"firstName\":\"John\" , \"lastName\":\"Doe\" }, 
    { \"firstName\":\"Anna\" , \"         


        
8条回答
  •  北海茫月
    2020-12-29 04:23

    You can send to an external tool, as an example, if you have python you can send the content to python's json tool using:

    :%!python -m json.tool
    

提交回复
热议问题