How do I order JSON properties in the Structure view?
Hi all,
When using a Scratch pad with JSON, is there a way to make the properties of an object sort alphabetiaclly?
Basically, when using the example from http://json.org/example.html, it currently looks like this in IntelliJ:
(Note: properties of the image object aren't sorted alphabetically, and the parten object's aren't, either.)
What I'm looking for is basically a sort button, as it appears on the Structure tab for Java classes:
so that I get a view that is similar to what http://jsonviewer.stack.hu/ would produce in it's (right-hand) sidebar (values displayed like in IntelliJ's debugger would be neat, but that's optional):
(Note: right hand list is sorted, showing immediate properties of the object selected.)
Is there an onboard option, or a plugin that can help?
(Basically, ideally I want the best of both worlds: tree of all objects, with all properties per object sorted alphabetically...)
Brgrds,
Christian
请先登录再写评论。
Featrue request for JSON properties sorting would be welcome at http://youtrack.jetbrains.com/issues/WEB . Thank you.
No, unfortunately, it's not possible at the moment. You can still use typeahead search in "Structure View" to quickly find neccessary properties. Nonetheless, I created the corresponding feature request in our tracker. Stay tuned.
Not a great answer; but, I use VIM biding and then, make each json top level element into it's own line (i.e. using J); then, I select a visual area (i.e. CTRL-V and move UP /DOWN to cover all lines where there are json top elements, then, finally, I use VIM to sort via :sort.
Finally, I can get PyCharm to reformat - it will keep the ordering: i.e. COMMAND-OPTION-L (on MAC).
Good luck.