Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.

Home Page:https://shopify.github.io/liquid/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Metafields type vs value_type breaks the liquid json function

jeremygottfried opened this issue · comments

I followed the directions to migrate to "type" instead of "value_type" for Shopify metafields.
https://shopify.dev/apps/metafields/migration

After switching, I can no longer transform metafields to json in liquid.

This code has always worked:

{{ product.metafields.merch | json }}

Actual output:
Screen Shot 2022-11-15 at 8 20 59 PM

Expected output:
Screen Shot 2022-11-15 at 8 21 48 PM

Old API code (works):

{
      key: 'preview_image',
      value: JSON.stringify({
        src: previewImage.url,
        contentType: previewImage.contentType,
      }),
      value_type: "json_string",
      namespace: "merch",
}

New API code (breaks liquid):

{
      key: 'preview_image',
      value: JSON.stringify({
        src: previewImage.url,
        contentType: previewImage.contentType,
      }),
      type: "json",
      namespace: "merch",
}