For the complete documentation index, see llms.txt. This page is also available as Markdown.

string

Casts a value to a string. Use it when a number must stay a string — IDs, SKUs, postal codes, anything with leading zeros — especially inside a {% json %} block.

{% assign sku = row.sku | string %}

Syntax

{{ value | string }}
Parameter
Description

value

Any value to convert to a string

Return Value

Returns a string. nil becomes ""; arrays and objects are JSON-serialized.

Examples

Keep an ID a string in a JSON payload:

{% json %}
{ "externalId": {{ order.id | string | json }} }
{% endjson %}

Output:

{ "externalId": "5123456789" }

This replaces the "{{ order.id }}" hand-quoting workaround, which breaks as soon as the value contains a quote or is nil.

Build a lookup key from a numeric column:

Concatenate without surprises:

Notes

  • Numbers, booleans and strings convert with standard string conversion: 12.5 | string is "12.5", true | string is "true"

  • nil and undefined become "", so the result is always a string

  • Arrays and objects are JSON-serialized rather than becoming "[object Object]": items | string is "[1,2]"

  • Different from json: json serializes for transport and quotes strings ("123" | json is "\"123\""), while string produces the bare string value

  • Casting a number to a string does not restore lost leading zeros — cast at the point the value arrives, before any arithmetic

  • See also: json, integer, type

Last updated