Formatters
In Lingtual, the Formatters
feature allows you to define the structure of your JSON data for streamlined processing by your apps and services. Currently, we offer a JSON Schema Formatter.


JSON Schema Formatter
The JSON Schema Formatter enables you to create a schema to validate and structure the JSON data going through your flows. By specifying the format and rules for your JSON data, you can achieve better control and understanding of your data pipeline.


Parameters
- JSON Schema: A JSON object specifying the expected format of the JSON data. You can define titles, descriptions, types, and required fields in this schema.
Simple Example
Here's a simple JSON Schema for person identification:
json_schema = {
"title": "Person",
"description": "Identifying information about a person.",
"type": "object",
"properties": {
"name": {"title": "Name", "description": "The person's name", "type": "string"},
"age": {"title": "Age", "description": "The person's age", "type": "integer"}
},
"required": ["name", "age"]
}
In this schema, each person must have a name
and an age
parameter. The name
is expected to be a string and the age
an integer.
Complex Example
Here's a more complex JSON Schema that structures user roles:
{
"name": "UpdateRoles",
"description": "Updates the roles of users.",
"parameters": {
"type": "object",
"properties": {
"role_users": {
"type": "array",
"items": {
"type": "object",
"properties": {
"rolename": {
"type": "string",
"enum": ["role1","role2","admin"],
"description": "The name of the role."
},
"email": {
"type": "string",
"description": "Email address of the user."
},
"action": {
"type": "string",
"enum": ["add", "remove"],
"description": "Action to be performed."
}
},
"required": ["rolename", "email", "action"]
}
}
},
"required": ["role_users"]
}
}
In this complex example, the schema expects an array of role_users
. Each object in this array must have rolename
, email
, and action
fields with specified types and acceptable values.
Support
For further assistance or inquiries about the Formatters
feature, feel free to contact us at support@lingtual.com.