Integration Server 10.3 | Built-In Services Reference Guide | JSON Folder | pub.json:validate
 
pub.json:validate
WmPublic. Validates JSON content against a JSON schema.
Input Parameters
schemaPath
String Optional. Absolute or relative path to a JSON schema file. If you specify the value of this parameter, do not specify schemaURL.
Note:
The JSON schema file must be either network accessible or present on the same file system as the Integration Server.
schemaURL
String Optional. URL to a JSON schema file. If you specify the value of this parameter, you need not specify schemaPath
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.
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, Missing Object).
path
String Location of the error.
Usage Notes
The JSON standard requires that field names be enclosed in double quotes. The pub.json: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:validate throws a ServiceException.
Specify only one of jsonString, jsonStream, or jsonDocument. If you specify more than one of these parameters, then pub.json: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:validate throws a ServiceException.