Edit online

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

Figure 1. Generate Sample JSON Files Dialog Box
The Generate Sample JSON Files dialog box includes the following fields and options:
Schema URL
The URL of the Schema location. 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.
Associate schema in the document
If enabled, the specified schema will be associated with the generated files.
Output folder
Path to the folder where the generated JSON instances will be saved.
File name
The name of the instance(s) that will be generated. By default, instance.json is used.
Number of instances
The desired number of JSON instances to be generated. When more than one instance is generated, the index of the instance will be added to its file name.
Property value
You can specify the way the values of the properties are generated. The following options are available:
  • None - Assigns empty values for properties (a template file will be generated). This is the default value.
  • Default - Assigns the name of the property as the value (for strings) or assigns the specified minimum value (for numbers).
  • Random - Assigns random values according to schema restrictions.
Generate optional properties
If selected, the JSON instance will be generated with optional properties that are defined in the JSON schema. Otherwise, only the required properties will be generated.
Generate additional content
If selected, the JSON instance will be generated with additional properties that are defined in the JSON schema as additionalProperties and additional items that are defined as additionalItems (in the case of an Array).
Choice strategy
You can specify the way an instance will be generated from a schema that contains a CombinedSchema (with either oneOf or anyOf). The following options are available:
  • First - The first defined schema in oneOf or anyOf will be used.
  • Random - A random schema defined in oneOf or anyOf will be used.
Recursion level
This option controls the maximum allowed depth (must be a number), in case the selected schema contains recursive calls of $ref schemas referencing one another. By default, it is set to 1, meaning that the generation for the recursive calls will stop after the first iteration.
Open first instance in editor
If selected, the first generated instance is opened in the editor.

You can click OK at any point to generate the sample JSON files.