Integration Server 10.5 | Built-In Services Reference Guide | JSON Folder | pub.json.schema:validate
 
pub.json.schema:validate
WmPublic. Validates JSON content against a JSON document type.
Input Parameters
jsonString
String Optional. JSON content for validation in a String. If you specify the value of this parameter, you need not specify jsonStream or jsonDocument.
jsonStream
java.io.InputStream Optional. JSON content for validation in an input stream. If you specify the value of this parameter, you need not specify jsonString or jsonDocument.
jsonDocument
Document Optional. JSON content for validation in a document (IData object). If you specify the value of this parameter, you need not specify jsonString or jsonStream.
streamEncoding
String Optional. Character encoding that applies to jsonStream. The default is UTF-8.
conformsTo
String Fully qualified name of a JSON document type on Integration Server against which the JSON content will be validated.
Output Parameters
isValid
String Flag that indicates whether or not validation was successful. A value of:
*true indicates that validation was successful.
*false indicates that validation was unsuccessful.
errors
Document List Conditional. Returned only when errors are encountered during validation.
Each document contains the following information:
Key
Description
code
String Error code (for example, JSV-001).
message
String Error message (for example, JSON schema validation failed).
path
String Location of the error.
Usage Notes
The JSON standard requires that field names be enclosed in double quotes. The pub.json.schema:validate service accepts input JSON content according to the JSON standard and treats field names not enclosed in double quotes (including unquoted field names) as invalid.
If the provided JSON input is invalid, then pub.json.schema:validate throws a ServiceException.
Specify only one of jsonString, jsonStream, or jsonDocument. If you specify more than one of these parameters, then pub.json.schema:validate considers only the first of the specified values for validation in the following order: jsonString, jsonStream, jsonDocument.
If you do not specify any JSON content for validation or the JSON schema file, then pub.json.schema:validate throws a ServiceException.