JSON Object Field
The Json Object Field represents a field that can be created in Model Builder, allowing the inclusion of JSON data in entries.
This field can be useful for storing complex data structures, or for integrating with external systems that use JSON as their primary data format. The following section explains the configuration of the Json Object in the model builder and its usage in an entry, depending on these configurations.
Json Object Field in Model Builder
When adding a Json Object Field in the model builder, you can configure its settings in the right sidebar. The field information that needs to be filled in includes:
Field name: This is the name of the field that will be displayed in entries and other relevant areas.
Alias: A required and unique identifier for the field, which cannot be modified once the field is saved.
Description: An optional field that allows you to describe the purpose or use case of the Json Object field.
Once you have filled in the necessary field information in the configuration sidebar, you can click the "Create" button at the bottom, and the Json Object field will be successfully added to the model editor.
Json Object Field Configuration
By selecting the Json Object field in the model editor, you have access to several quick actions. These actions enable you to delete the field, open the configuration sidebar, and adjust the field's position within the model.
The Configuration sidebar consists of three tabs: General, Appearance, and Validations. These tabs provide various settings and options for customizing the behavior and appearance of the Json Object field.
General tab
The General tab in the configuration of the Json Object field contains essential field information, including Field name, Alias, and Description.
Note that while Field name and Description can be modified even after saving the field, the Alias cannot be modified once the field has been saved in the model builder.
Appearance tab
The Appearance tab in the configuration of the Json Object field focuses on how the field will be displayed in the entries created by the model. For this field, there is only one available option: "JSON" which is selected by default.
The Appearance tab also includes the Help Text field. This field can be used to display a tooltip or inline text in the entry based on the selection, providing users with additional guidance and understanding of how to use the text field effectively.
Validations tab
In the Validations tab, you have the ability to apply constraints to the Json Object field. These constraints enforce specific requirements on the field's input, ensuring that the entry cannot be published unless the Json Object field adheres to these restrictions. The available options for validation include:
Required field: If you select this option, the Json Object field must be filled when creating an entry. It becomes mandatory to input a value in the Json Object field before the entry can be published.
In addition to this option, you can enable a condition that makes this field required depending on the value of another text field. After enabling this option, you can continue to fill in the fields as follows:
Field: Opens a dropdown menu listing all the text fields of the current model.
Operator: Opens a dropdown menu with operators such as contains, does not contain, equals, does not equal, exists, and does not exist.
Value: Enter the desired value.
Read-only: This option allows you to make the field read-only for users.
Additionally, you can set a condition that makes this field read-only depending on the value of another field. After enabling this option, you can continue to fill in the fields as follows:
Field: Opens a dropdown menu listing all the text fields of the current model.
Operator: Opens a dropdown menu with operators such as contains, does not contain, equals, does not equal, exists, and does not exist.
Value: Enter the desired value.
Limit number of properties: This option allows you to limit the number of properties that users can input into the Json Object field. Users will only be able to enter properties within this specified range. The available options are:
Between: With this option, you can set both a minimum and a maximum value. Users will be restricted to input properties that fall between these two values.
At least: This option sets a minimum value, and users must input a property that is equal to or greater than the specified minimum.
No more than: With this option, you can define a maximum value, and users must input a property that is equal to or less than the specified maximum.
Invalid JSON message: This option enables you to specify a customized invalid message that will be displayed to the user when they attempt to add a JSON object that is invalid.
By leveraging the Validations tab, you can ensure that the Json Object field in your model enforces specific constraints, maintaining data integrity and consistency in your entries.
Json Object Field in Entry Editor
The Json Object field in the entry will be displayed and can be used based on the configuration in the model. Let's explore some appearances and use cases of the Json Object field in the entry editor.
Help Text Tooltip: If help text is added to the Json Object field in the model's configuration and its display is set to "Tooltip", it will be displayed as a tooltip near the field's title in the entry editor, providing additional guidance.
Help Text Inline: If help text is added to the Json Object field in the model's configuration and its display is set to "Inline text", it will be displayed as inline text near the field's title in the entry editor, providing additional guidance.
Required field: If the Json Object field is marked as a required field in the model, the user cannot publish the entry without adding JSON data in the respective field. A warning message with a red color will be displayed under the field, indicating that the Json Object field is required.
Read-only: If the Read-only option is enabled in the model, the user can view this field as read-only.
Number of properties: If a specific limit for the number of properties is defined for the Json Object field in the model, the user cannot publish the entry if the entered value does not fall within the specified limit. A warning error with a red color will be displayed under the field, depending on the template configuration in the model.
Invalid message: If the JSON data added in the respective field of the entry is invalid, an error message will be displayed under the field, indicating that the Json Object field is invalid.