Formatting XML and JSON using Sublime Text

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Formatting XML and JSON using Sublime Text相关的知识,希望对你有一定的参考价值。

Formatting XML and JSON using Sublime Text

Last week I was trying to make some changes to my WCF service and had to deal with some XML data. The problem was the XML was not nicely formatted and I had to highlight couple of missing pieces of information. Normally I would use Notepad++ but I though let‘s try doing it in?"Sublime Text".

If you are new to this editor you can read my?this?post which describes the basic steps to get started with Sublime Text. As a web developer we often have to deal with non formatted XML and JSON data. Sublime Text has a plugin?Indext XML?that you can use to format XML and JSON data. The plug-in is available in both ST2 & ST3.

Installing Plug-in

Open the editor and hit?Ctrl+Shift+P?to open?Command Palette.

技术分享

Type"Install Package" and hit?Enter. Type?Indent XML.

技术分享

Select the highlighted plug-in and click Enter. You should see the message that saying the plug-in has been installed successfully.

技术分享

Restart the editor. At least I had to.

Formatting XML

Copy the non formatted XML

技术分享

Hit?Ctrl + K + F.

技术分享

You can also do it from the Menu option.

技术分享

Formatting JSON

技术分享

Hit?Ctrl + K + F.

技术分享

You can also do it from the Menu option.

技术分享

That‘s it for today. Happy Formatting !

以上是关于Formatting XML and JSON using Sublime Text的主要内容,如果未能解决你的问题,请参考以下文章

Json Formatting.Indented 使用 Web Api 控制器、ASP.NET MVC

JSON and XML Serialization in ASP.NET Web API

java 添加变量String.xml。字体:https://code.tutsplus.com/tutorials/android-sdk-quick-tip-formatting-resource

Convert ResultSet to JSON and XML

css CSS:字符作为内容。使用http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references中的“U +

将 XML 转换为 JSON 格式