Contact Us 1-800-596-4880

DataFormat Types (dw::extension::DataFormat)

Type Definition Description


type DataFormat = { binaryFormat?: Boolean, defaultCharset?: String, fileExtensions?: Array<String>, acceptedMimeTypes: Array<MimeType>, reader: (content: Binary, charset: String, settings: ReaderSettings) -> Any, writer: (value: Any, settings: WriterSettings) -> Binary }

Represents the DataFormat definition and contains the following fields:

  • binaryFormat: True if this is data format is represented as binary representation instead of text. False if not present.

  • defaultCharset: Default character set of this format, if any.

  • fileExtensions: Returns the list of file extensions with the . (for example, .json, .xml) to assign to this data format.

  • acceptedMimeTypes: The list of MIME types to accept.

  • reader: Function that reads raw content and transforms it into the canonical DataWeave model.

  • writer: Function that writes the canonical DataWeave model into binary content.

Introduced in DataWeave version 2.2.0.


type EmptySettings = Object

Represents a configuration with no settings.

Introduced in DataWeave version 2.2.0.


type EncodingSettings = { encoding?: String {defaultValue: "UTF-8"} }

Represents encoding settings and contains the following field:

  • encoding: Encoding that the writer uses for output. Defaults to "UTF-8".

Introduced in DataWeave version 2.2.0.


type MimeType = String

Represents a MIME type, such as application/json.

Introduced in DataWeave version 2.2.0.


type Settings = Object

Reader or writer configuration settings.

Introduced in DataWeave version 2.2.0.