Skip to content
Log in

cast - Liquid Filter Reference

On this page

Description

Casts the variable to a different data type. Can cast, strings and numbers. Records can be case to their liquid object. Note: not all Records can be cast to a liquid object.

Property Value
Return Type any
Category general

Examples

```liquid

{{ contact_record | cast: ‘string’ }} ```

Output: Contact

```liquid

{{ “35” | cast: ‘number’ }} ```

Output: 35

```liquid

{{ 35 | cast: ‘string’ }} ```

Output: 35

```liquid

{{ contact_record | cast: ‘liquid_object’ }} ```

Output: Contact

Was this article helpful?

Was this article helpful?