New JSON editor features in Visual Studio 2013 Update 2 CTP2

New JSON editor features in Visual Studio 2013 Update 2 CTP2

Rate This
  • Comments 17

The Customer Tech Preview (CTP2) release of Visual Studio 2013 Update 2 contains a new JSON editor. In this release, the JSON editor includes a number of features such as colorization, and JSON syntax validation. More features will be added during subsequent releases.

New JSON item template

In a web application, you can use the new JSON item template under the Markup category to add a new file with the .json extension.

clip_image001

Colorization

When opening a file in the JSON editor, the content will be tokenized and have distinct colors. Invalid tokens will have the default black color as shown below.

clip_image002

The color for numbers can be set using the setting at Tools –> Options –> Environment –> Fonts and Colors –> Number.

clip_image003

JSON syntax validation

Visual Studio 12 Update 2 will validate JSON syntax and provide squiggle syntax errors that have been detected, and list them in the Error List window. Double-clicking on an error in the Error List will bring the file to the foreground if it’s not currently active and put the cursor at the error.

clip_image004

Automatic brace completion and type-through

When you type an opening bracket or quote, the matching closing character is automatically inserted after the cursor. If you type the automatically inserted character, you will “type through” that character. This would help keep your fingers in home position and maintain the typing flow.

clip_image005

Outlining

Outlining is available for the JSON content so you can choose to either collapse or expand any part of the content for easy viewing.

clip_image006

Tools Options Settings

In addition to the general Text Editor settings, we offer the Validation settings under the Advanced tab that you can change to suite your desire.

clip_image007

JSON content sniffing

When double-clicking a file in Solution Explorer to open a file with an unknown extension, the JSON editor will scan through the content of the file and determine if it’s indeed a JSON file. If so, the JSON editor will open the file and you will see all of the features mentioned above.

However, if the JSON editor detects that there are more than 5 errors in the first 4 kilobytes of the content, it will quit and the file will be treated the same way as an unknown file extension, where it will be opened in whatever editor set as the default.

There will be additional features in the JSON editor in subsequent releases and we will blog more about them when they become available.

Leave a Comment
  • Please add 8 and 6 and type the answer here:
  • Post
  • lamphuff

  • Good 1.

  • This is great.

  • Is Format Document supported for json to take a long value from a service request and format it for easy reading?

  • @Jim,

    Document Formatting is not available for this CTP2 release yet, but will be in a subsequent release.

  • This is awesome.  It's about time, and a feature that should have been in the initial release or even in VS2012.

  • All the above demonstrates the user of "" to defined keys/properties, while strictly speaking they are required (afaik) many parsers support a more lose format like { name: 'value' }... Any plans to support a variety of formats?

  • @ Jens,

    We've decided to stick to the standard JSON rules of using double quotes. So there's no plan to support a lose format of single quote.

  • Really looking forward to 'Format Document' until then I'm still stuck copy and pasting stuff around.

  • Suggestion: Providing YouTube / Channel 9 video for contents like these will help learn/read much faster

  • Looking forward to the document formatting enhancement.

    Thanks for building and continuously improving an awesome development tool.

  • Are there any updates with JSON Document Formatting?

  • @Karlo, We've announced the JSON formatting feature in blogs.msdn.com/.../announcing-new-web-features-in-visual-studio-2013-update-3-rtm.aspx

  • We have JSON document formatting in VS 2013 Update 3 RTM which was released in July.

  • I use JSON files for my WPF and Console applications for configuration files and network TCP/IP client/server communication (security will not allow the computers I work on to be internet connected).   Why can't the JSON file template be available for all project types?

Page 1 of 2 (17 items) 12