Contact Us 1-800-596-4880

toString

toString(mimeType: MimeType): String

Transforms a MimeType value to a string representation.

Introduced in DataWeave version 2.7.0.

Parameters

Name Type Description

mimeType

MimeType

The MIME type value to transform to a String.

Example

This example transforms a MimeType value without parameters to a string representation.

Source

%dw 2.0
import * from dw::module::Mime
output application/json
---
toString({'type': "application", subtype: "json", parameters: {}})

Output

"application/json"

Example

This example transforms a MimeType value that includes a parameters to a string representation.

Source

%dw 2.0
import * from dw::module::Mime
output application/json
---
toString({'type': "multipart", subtype: "form-data", parameters: {boundary: "my-boundary"}})

Output

"multipart/form-data;boundary=my-boundary"