--- alias: user-guide-automation-converter-anytostring description: "This converter attempts to transform any value into a string format" --- # Any to String This converter tries to transform any value into a string. This converter applies the .toString() javascript function if it is not converting an object, if it is an object it will have different behaviors. If it is converting an object of type: - **DateTime**: it will convert it to a string in the ISO 8601 format (`YYYY-MM-DDTHH:mm:ss.sssZ`), using the javascript function .toISOString(); - **Error**: it will return a Json string value with the elements of the error; - **Map**: it is transformed into an object with one property per key and then into a JSON string, using JSON.stringify; - **Unspecified**: its properties are listed as `key='value'` pairs separated by commas; ## Settings This converter has no settings. ![image119][image119] [image119]: ./images/image119.png ## Examples | Input | Output | | ------------------------------------------- | -------------------------------------------------- | | `Date("2024-08-12T12:00:00Z")` | `2024-08-12T12:00:00.000Z` (ISO 8601) | | `Moment("2024-08-12T12:00:00Z")` | `2024-08-12T12:00:00.000Z` (ISO 8601) | | `new Error("Test error")` | JSON string containing the error's own properties | | `new Map([["key", "value"]])` | `{"key":"value"}` | | `{ key: "value" }` (generic object) | `key='value'` | | `undefined` | empty string | | `() => { }` (function) | `() => { }` (the function's own `toString()`) | Table 1: Examples ### Failure Behavior This converter never fails. When the input value is `undefined`, the converter returns an empty string, and when it is `null`, it returns ``. See [[user-guide-automation-converters-index]] for the full set of failure patterns across converters.