Hear from Salesforce leaders on how to create and deploy Agentforce agents.
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: {}})
DataWeave

Output

"application/json"
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"}})
DataWeave

Output

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