Edit online

Generating JSON Schema from a JSON File

Oxygen XML Editor includes a tool for generating a sample JSON Schema from a JSON file. To generate a sample JSON Schema, select Generate JSON Schema from the Tools > JSON Tools menu. The action opens a dialog box where you can configure some options for generating the JSON Schema.

Figure 1. Generate JSON Schema Dialog Box
The Generate JSON Schema dialog box includes the following fields and options:
JSON Document URL
The URL of the JSON file. You can specify the path by using the text field, the history drop-down menu, or the browsing actions in the Browse drop-down list.
Output JSON Schema
The path to the folder where the generated JSON Schema will be saved.
Open in Editor
If selected, the generated JSON Schema is opened in the editor.
JSON Schema version
The version of the resulting JSON schema. The possible choices are: Draft 4, Draft 6, Draft 7, 2019-09, and 2020-12.
Extract matching format for strings
If selected, the generator will attempt to find a format that matches the string values from the JSON Document.
Restrict additional content
If selected, additionalProperties (for objects) and additionalItems (for arrays) will be set to false in the resulting schema. By default, these keys are not in the schema, meaning that providing additional content (according to the schema) is allowed.
Add default values for simple types
If selected, the default values (0 for number, "" for string, false for boolean) and examples for strings will be added.
Make all properties required
If selected, the generator will mark all the properties as required in the resulting schema.

You can click Generate at any point to generate the JSON Schema.