Edit online

JSON Editor

Oxygen XML Editor Eclipse plugin includes a specialized JSON editor with various editing features for files that have the json file extension. It also includes a document template to help you get started with JSON documents. The template is called JSON and it can be found in the New Document folder in the New from templates wizard.
Tip: You can experiment with a sample of a JSON file available at: [OXYGEN-INSTALL-DIR]/samples/json/personal.json.

Text Mode Editor

When editing JSON documents in the Text editing mode, the usual text editing actions are available, along with other editor-specific actions, including:

The JSON Text mode editor also offers unique features. For example, the property name is displayed after the ending bracket:

Note: You can run XPath expressions on open JSON documents, but in Text mode the XPath results cannot be mapped in the document. However, they can be mapped in the Grid editing mode. You can use the Grid button at the bottom of the editor panel to switch to that editing mode.

Grid Mode Editor

Oxygen XML Editor Eclipse plugin allows you to view and edit the JSON documents in the Grid mode. The JSON is represented in Grid mode as a compound layout of nested tables and the JSON data and structure can be easily manipulated with table-specific operations or drag and drop operations on the grid components.

Figure 1. JSON Editor Grid Mode
You can also use the following JSON-specific contextual actions:
Array
Useful when you want to convert a JSON value to array.
Insert value before
Inserts a value before the currently selected one.
Insert value after
Inserts a value after the currently selected one.
Append value as child
Appends a value as a child of the currently selected value.

You can customize the JSON grid appearance according to your needs. For instance, you can change the font, the cell background, foreground, or even the colors from the table header gradients. The default width of the columns can also be changed.

Author Visual Editor

You can edit JSON files in the visual Author editing mode and you have access to the various features and actions that are available when editing XML documents in Author mode. When a JSON document is opened in Author mode, it is automatically converted to proper XML structure using the built-in JSON to XML Converter. Additionally, for Boolean, Number, and Null types, an oxy_Type="[symple_type]" attribute structure is added in the XML to preserve the type of the value from the JSON document.

Figure 2. JSON Editor Author Mode
You can also create your own custom JSON framework, similar to the process for creating custom XML frameworks. For example, to create a document type association (framework) for JSON documents, you could:
  • Add a rule to match the "JSON" as the root local name.
  • Add a rule to match the topProperties attribute that contains a value that is the name of the properties from the first level of the JSON document.
  • Add a rule to match the schema attribute that contains a value that is the associated schema from the $schema property.
Note: The default JSON framework has the Lowest priority in the Document Type Association preferences page. If you create a custom JSON framework, you need to set it to a higher priority. Otherwise, the Author mode rendering will revert to the default JSON framework.
Tip: You can experiment with some samples of custom JSON frameworks available in the [OXYGEN-INSTALL-DIR]/samples/json/author/ directory. There is a sample application form called residentCardForm.json and a sample travel guide called travel-guide.json, along with referenced resources in the images folder.

For more information about the visual editing support for JSON, watch our video demonstration: