Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSON editor (highlight, collapse, validate) in Visual Studio 2012 IDE

Tags:

It is strange, but I've been searching a while with no acceptable result for finding a tool to highlight, validate and collapse JSON file data to edit manually in visual studio. I'm not even dreaming about IntelliSense yet. It is so popular format and no chance to edit it IDE? No plugins or native support. Trying to wire scripteditior to json had no effect.

The closest thing I've got to be able to edit json manually in convenient way is Google Chrome extension for http://jsoneditoronline.org/ that allows me to open and save files from local disk.

I've also tried to search for solutions for Visual Studio 2010 - but could not find any for this version either.

Anybody know how I can have this functionality in VS IDE?

like image 837
Sergey Novikov Avatar asked Jan 15 '13 10:01

Sergey Novikov


People also ask

How do I beautify json in Visual Studio code?

Formatting# You can format your JSON document using Ctrl+Shift+I or Format Document from the context menu.

How do I run a json file in Visual Studio?

In Visual Studio Code, use shortcut Ctrl + Shift + P to open the Command Palette and type Open launch. json . And it will open the launch. json file for you.

How do I add a json file to Visual Studio?

If you want to add a json file directly, you can right click ->add items->choose Json file.

How do I beautify json in Notepad ++?

Open notepad++ -> ALT+P -> Plugin Manager -> Selcet JSON Viewer -> Click Install. Restart notepad++ Now you can use shortcut to format json as CTRL + ALT +SHIFT + M or ALT+P -> Plugin Manager -> JSON Viewer -> Format JSON.

What is JSON editing in Visual Studio Code?

JSON editing in Visual Studio Code Editing JSON with Visual Studio Code JSON is a data format that is common in configuration files like package.json or project.json. We also use it extensively in Visual Studio Code for our configuration files.

How do I enable comments in the JSON editor?

When in the JSON with Comments mode, you can use single line (//) as well as block comments (/* */) as used in JavaScript. The current editor mode is indicated in the editor's Status Bar. Click on the mode indicator to change the mode and to configure how file names and extensions are associated to modes.

How do I Collapse a region in Visual Studio?

You can also collapse an outlining region by double-clicking any line in the region on the outlining margin, which appears just to the left of the code. You can see the contents of a collapsed region as a tooltip when you hover over the collapsed region. This topic applies to Visual Studio on Windows.

Does VS Code support JSON Schema Draft 7?

The JSON support shipped with VS Code supports JSON Schema Draft 7. Servers like JSON Schema Store provide schemas for most of the common JSON-based configuration files. However, schemas can also be defined in a file in the VS Code workspace, as well as the VS Code settings files.


2 Answers

One option is to use the Text Highlighter extension for Visual Studio 2012, which offers syntax highlighting for the following text formats:

  • .json (also offer syntax validation)
  • .bat
  • .cmd
  • .ini
  • .txt
  • .log
like image 143
Frederic Torres Avatar answered Sep 28 '22 06:09

Frederic Torres


Great news!

In CTP2 of Visual Studio 2013 Update 2 that was added a New JSON project item and editor

enter image description here

like image 44
Dmitry Pavlov Avatar answered Sep 28 '22 07:09

Dmitry Pavlov