Contact Us 1-800-596-4880

JSON Module Reference - Mule 4

JSON Module v2.3

The JSON module provides extra functionality for processing JSON documents. Although DataWeave is the tool that Mule uses to access data in JSON documents, this module provides extra functionality that falls outside of DataWeave’s scope, like schema validation.

Release Notes: JSON Module Release Notes

Configurations


Default Configuration

Default configuration

Parameters

Name Type Description Default Value Required

Name

String

The name for this configuration. Connectors reference the configuration with this name.

x

Operations

Validate Schema

<json:validate-schema>

Validates that the input content is compliant with a given schema. This operation supports referencing many schemas (using comma as a separator) which include each other.

This connector supports JSON Schema Validation Drafts 3 and 4 only.

Parameters

Name Type Description Default Value Required

Content

Any

The JSON document to validate.

#[payload]

Schema Redirects

Array of Schema Redirect

Allows to redirect any given URI in the Schema (or even the schema location itself) to any other specific URI. The most common use case for this feature is to map external namespace URIs without the need to a local resource.

Dereferencing

Enumeration, one of: CANONICAL INLINE

Draft v4 defines two dereferencing modes: canonical and inline. CANONICAL is the default option, you can also specify INLINE. When validating a v3 draft, this attribute is ignored.

CANONICAL

Allow Duplicate Keys

Boolean

If true, the validator allows duplicate keys, otherwise it fails

true

Allow Arbitrary Precision

Boolean

If true, the validator uses arbitrary precision when reading floating point values, otherwise it uses double precision.

false

Schema

String

The location of the validate schema to validate. This attribute supports URI representations such as "http://org.mule/schema.json" or "resource:/schema.json". It also supports a most common classpath reference such as simply "schema.json".

SchemaContent

String

The content of the schema to validate in text format.

Throws

  • JSON:INVALID_INPUT_JSON

  • JSON:INVALID_SCHEMA

  • JSON:SCHEMA_NOT_FOUND

  • JSON:SCHEMA_NOT_HONOURED

  • JSON:SCHEMA_INPUT_ERROR

Types

Schema Redirect

Field Type Description Default Value Required

From

String

The original location

x

To

String

The redirection location

x

View on GitHub