%dw 2.0
import * from dw::module::Mime
output application/json
---
toString({'type': "application", subtype: "json", parameters: {}})
DataWeave
toString
toString(mimeType: MimeType): String
Transforms a MimeType
value to a string representation.
Introduced in DataWeave version 2.7.0.
Parameters
Name | Type | Description |
---|---|---|
|
|
The MIME type value to transform to a |
Example
This example transforms a MimeType
value without parameters
to a string representation.
Source
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