Skip to content

고급 필터

이 참조 기사는 Liquid의 고급 필터에 대한 개요와 그것들이 어떻게 사용될 수 있는지를 제공합니다.

인코딩 필터

URL 필터

속성정보 접근자 필터

해시 예시: {"a" => 42, "b" => 0} 입력 예시: {{hash | property_accessor: 'a'}} 출력 예시: 42

또한 속성 접근자 필터를 사용하면 사용자 지정 속성을 해시 키로 템플릿화하여 특정 해시 값에 액세스할 수 있습니다.

숫자 서식 필터

JSON 이스케이프 / 문자열 이스케이프 필터

이 필터는 JSON 사전에서 문자열을 개인화할 때 항상 사용해야 하며 특히 웹훅에 유용합니다.

JSON-formatting filters

json_parse example input and output

Input

1
2
{% assign my_data_string = '[{"id":"1","store_name":"demo-store"}]'  %}
{% assign my_data = my_data_string | json_parse %}

Output

1
2
3
4
{% for item in my_data %}
Item ID: {{ item.id }}
Item Name: {{ item.store_name }}
{% endfor %}
as_json_string example input and output

Input

1
2
3
{% assign my_data_string = '[{"id":"1","store_name":"demo-store"}]'  %}
{% assign my_data = my_data_string | json_parse %}
{% assign json_string = my_data | as_json_string %}

Output

1
{{json_string}}
New Stuff!