Software AG Products 10.7 | Integrating On-Premises and Cloud Applications | Service Development | Working with JSON Document Types | What Is a JSON Document Type?
 
What Is a JSON Document Type?
JSON document types are based on JSON schemas and provide support for JSON schema features such as validation. Every instance of a JSON document type includes a root document. Within this root document, an instance can include:
*Fields that correspond to JSON schema fields and contain validation properties.
*Other JSON document types that correspond to the JSON objects in the given JSON schema.
Note:
The ref keyword in a JSON schema will generate another JSON document type and include that document type in the top-level document type.
The following samples show a JSON schema and the JSON document type created from that schema.
JSON Schema
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/example.json",
"type": "object",
"properties": {
"address": {
"type": "object",
"properties": {
"streetAddress": {
"type": "string"
},
"city": {
"type": "string"
}
}
},
"phoneNumber": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"number": {
"type": "number"
}
}
}
}
}
}
If the JSON folder is selected as the namespace and the text "doc" is provided as the document name while generating the JSON document type for the above schema, the following JSON document type is generated:
The fields in the above JSON document type have the following data types:
Element
Type
address
Document
streetAddress
String
city
String
phoneNumber
Array of Documents
type
String
number
Object – java.lang.Double