Skip to content

string ​

Casts the input to a string.

Type: transform

Aliases ​

toString, string

Parameters ​

  • input (unknown): The input can be any type.
  • prettify (boolean): If true, the output will be pretty-printed.

Returns ​

Type: string

The input converted to a JSON string representation.

Examples ​

javascript
string(123) // "123"
javascript
123|string // "123"

Released under the MIT License.