VideosJSON Editing

Overview

Duration: 06:23
This video demonstration provides a brief overview of the JSON editing support in Oxygen after various improvements were implemented in version 21.0. The features shown in the video include the functionality of the Outline view, content completion assistance, associating a JSON Schema to a JSON document, defining code templates, and more.

Transcript

00:00:16The Outline view was redesigned to work seamlessly with JSON documents.
00:00:21Major improvements of the Outline view include: - support for all types of JSON constructs
00:00:27(for example, objects, arrays, or simple types)
00:00:33It's functionality is similar to the Outline view for XML documents.
00:00:38You can search for a specific JSON property name
00:00:41The Outline view is synchronized with the main editing pane.
00:00:47It now features a more robust internal model that displays the document structure even if the JSON content is not well formed
00:00:57and...when a validation problem is found, an error icon is displayed in the Outline tree, allowing
00:01:03you to easily pinpoint the source of the error.
00:01:06You can also hover over the icon to see a tool-tip with details about the problem
00:01:15Another major improvement was the addition of an intelligent Content Completion Assistant
00:01:20that offers proposals for quickly inserting JSON structures that are valid
00:01:25at the current editing location.
00:01:27This feature is schema-driven and the list of proposals depend
00:01:31on the associated JSON Schema.
00:01:35For our example, I already have a JSON schema that defines our JSON document structure.
00:01:42Thera are two ways to associate a JSON Schema to a JSON document.
00:01:47You can create a validation scenario that binds the JSON schema with the current document.
00:01:57Here, I need to specify the URL of the JSON schema in the validation scenario.
00:02:08Another method is to associate the JSON schema directly in the document by using
00:02:13the "Associate Schema" action, that is available on the toolbar.
00:02:23Notice that a schema property was added at the beginning of the document with its value set to the
00:02:30specified URL.
00:02:32Note that if both types of schema association, are used for a document
00:02:37the schema defined in the validation scenario has a higher priority
00:02:41and...will be used by the validation engine, content completion and for other actions such as "Go to definition".
00:02:49To quickly access the schema associated with the current document, select the Open Associated
00:02:55Schema action from the toolbar.
00:03:01The properties and values that can be inserted in a specific context are presented automatically
00:03:07when you edit the JSON document.
00:03:10To show how this works, I'll insert properties for a new "person" .
00:03:14The Content Completion Assistant can be triggered in a valid location every time you press CTRL+Space,
00:03:22or the Enter key, or you type a single or double quote character.
00:03:26As I'm inserting this properties and values
00:03:29I'm invoking the Content Completion Assistant by pressing Enter.
00:03:44Note that Oxygen displays documentation for each proposal in a small window next to the Content Completion window.
00:03:51This information is collected from the associated JSON schema.
00:03:57I can right click a property and select "Go to definition" to open the schema where that property is defined.
00:04:05Proposing valid code constructs at the current editing location makes it easier and faster
00:04:11to edit JSON documents and keep them well-formed.
00:04:28The content completion assistant also includes built-in JSON code templates to help you insert bigger JSONcode fragments.
00:04:37Just press Ctrl + Shift + Space to see a complete list of the available code templates.
00:04:43You can also define your own code templates.
00:04:47As an example I'll create a code template based upon the "person" fragment that I just added, where I inserted the properties one by one.
00:04:56This will speed up the process of adding a new "person" definition in the future.
00:05:03To create a Code template, I"ll copy an existing "person" fragment
00:05:08then I'll open the Preferences dialog ...and look for the Code templates preferences page.
00:05:15Now I click "New" to create a fresh code template...
00:05:19Some of the fields are optional but I need to add a name for the code template,
00:05:23specify the editor type, and then in the content area I can paste the copied content.
00:05:31I'll edit the fragment and keep only the relevant information.
00:05:36Then I'll click OK, to save my changes.
00:05:40To enter the code template in my document, I place the cursor at a valid location
00:05:46press Ctrl+Shift+Space to invoke the Content completion list.
00:05:50The new Code template is now available in the list of proposals.
00:05:54Now I select the apropiate template and press Enter.
00:05:58And I"ll use the Format and Indent action to make the document look better.
00:06:03Now I can continue to input information in the inserted fragment.
00:06:14And this concludes the demonstration. As always, thanks for watching!

Use Oxygen Feedback to ask us anything about this video.