Customize and configure JSON elements, keys/fields, and classes in your JSON Schema editor.
Main sections of the Schema editor include Root, Elements, and Sample Data.
Root
This section displays the Root Field, which indicates the first element in your JSON document body.
It also shows the Override Key Name field, which can be used to override a root field name when the key is wrapped in an object. What the Ruleset reads/writes as 'fields' is referenced as a ‘key’ in JSON. When nothing is specified in this field, then both key and field can have the same name. However, there are valid keys that are not valid field names; in that case, you must use Override Key Name to define the key name in order to read/write data in the JSON format correctly. As an example, JSON keys can contain spaces; field names cannot.
Consider these variations that could appear in your sample data.
[ 1 ] Is Array, no Key
{“Key”: [1]} Is Array, with Key
1 Is not Array, no Key
{“Key”: 1} Is not Array, with Key
A Clear button can be used to remove an Override Key Name.
When the Is Array checkbox is selected, this defines the root as a JSON array (an ordered collection of values), shown as [] in the element. Values are separated by a comma.
Elements
- Add fields
- Add classes
- Delete selected elements
- Move (re-order) fields
- Re-name classes and fields
Fields and Classes are defined by using the Properties view, which has the General Information and Type Information sections.
- Name: Displays the name of the selected element or field. Click in this field to edit.
- Override Key Name: can be used to override a root field name when the key is wrapped in an object. What the Ruleset reads/writes as 'fields' is referenced as a ‘key’ in JSON. When nothing is specified in this field, then both key and field can have the same name. However, there are valid keys that are not valid field names; in that case, you must use Override Key Name to define the key name in order to read/write data in the JSON format correctly. As an example, JSON keys can contain spaces; field names cannot.
- Type: Defines the type (primitive or composite).
- Is Array (checkbox): Defines if it has an array or allows more than one type.
Sample Data
- Clear Sample Data: clears whatever is currently displayed,
- Copy to Clipboard: copies sample data; this can be used to create another Schema, or to copy directly from one editor to another (or file, sample, etc).
- Import new JSON Data: replaces current sample data with imported data.
- Use this option when you need to add new classes or fields to an existing JSON Schema.
- When a different override key name exists in the imported data, a new field is created.
- Do not use this option when you creating a completely new Schema. This is not an override.
- Do not use this option to reflect deleted data; this must be done manually from the Elements section.
Recommendation: Use the Elements section when making minor changes to an existing JSON Schema. Just keep in mind that changes made from Elements are not reflected in the Sample Data section.
Comments
0 comments
Please sign in to leave a comment.