{"title":"cast - Liquid Filter Reference","slug":"cast-filter-reference","url":"https://support.storeconnect.com/articles/cast-filter-reference","url_markdown":"https://support.storeconnect.com/articles/cast-filter-reference.md","subtitle":null,"summary":"Converts a variable to a different data type such as string, number, or Liquid object. Use `cast` when you need to change a record or value to the correct type for further processing.","type":"Developer_Documentation","video_url":"","keywords":"liquid, filters, cast, general, storeconnect","last_modified":"2026-08-21T07:12:35+0000","body_markdown":"## Description\n\nCasts 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.\n\n| Property | Value |\n|----------|-------|\n| **Return Type** | any |\n| **Category** | general |\n\n## Examples\n\n\n```liquid\n\n{{ contact_record | cast: 'string' }}\n```\n\n\n**Output:** `Contact`\n\n\n```liquid\n\n{{ \"35\" | cast: 'number' }}\n```\n\n\n**Output:** `35`\n\n\n```liquid\n\n{{ 35 | cast: 'string' }}\n```\n\n\n**Output:** `35`\n\n\n```liquid\n\n{{ contact_record | cast: 'liquid_object' }}\n```\n\n\n**Output:** `Contact`"}