Thursday, September 27, 2012

JSON file autoformat

I often need to reformat json code.

The problem I have is it always indent the first line of a hash

e.g.
[quote]
"a" : {
"b" : "c",
"d" : "e"
}
[/quote]

becomes

[quote]
"a" : {
"b" : "c",
"d" : "e"
}
[/quote]

Is there any way to solve this problem?

I am aware of the :%!python -m json.tool method, however it give my code a re-sorting, which I have to avoid.

Any idea?

Thanks for your advice!

Primus

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment