Working With New JSON Editor in Visual Studio 2013 CTP2 Update2

Introduction

As you know, the Visual Studio team released the Visual Studio 2013 Customer Tech Preview (CTP) 2 Update 2, and there are various new changes also. You can also refer to Getting Started with Visual Studio 2013 Update2 to learn more about the new Visual Studio release. Among them, I am defining the JSON editor features here with which now we can perform the colorization and validation. More features will be added in the next releases.

There are the following sections defined below that is the categorization of JSON features.

JSON in Add New Item

Now the JSON item is available under the Markup category when adding a new item to the web application.

Adding JSON File in Web Application

Colorization

Now when we open the file in the JSON editor, the content will be tokenized and have distinct colors. The default color is as it is for the invalid tokens. Have a look:

Colorization in Json

You can also set the color by "Tools" -> "Options" -> "Environment" -> "Fonts and Colors" -> "Number".

Fonts and Colors in Environment

Validation

The Visual Studio 2013 update will validate JSON syntax and provide curl syntax errors that have been detected and you can see them in the Error List window. It can also bring you to the specific location, if you double-click on the error.

Validation in JSON File

Automatic Bracket Completion

When typing on the editor, now you can code more quickly and easily. When you type an opening bracket or quote, the matching closing character is inserted automatically. If you type the automatically inserted character then you'll "type through" that character.

Automatic Brackert Completion in JSON File

Outlining

Now you can choose the Collapse to Definition options or expand any part of the content for easy structuring. Have a look:

Outlining in Json File

Tools Options

You can also perform settings on the Advance tab in JSON.

Validation Settings of JSON 

JSON sniffing

When double-clicking on a file in the Solution Explorer with an unknown extension, the JSON editor will scan through the content of the file and determine if it is indeed a JSON file.

Summary

There are various new changes made in the JSON editor and this article shows how to do some of them. There are more features coming soon in the subsequent releases. Thanks for reading and stay updated.