JSON metafield through liquid

Topic summary

A user encountered an issue accessing values from a JSON metafield containing an array of license objects (with license_id, product_name, and expiry_date fields) through Liquid templating.

Problem:

  • The Liquid code wasn’t properly outputting values from the customer metafield customer.metafields.custom.purchased_license_record
  • The metafield contained structured JSON data with multiple license records

Solution:

  • Adding .value to the metafield reference resolved the issue
  • Correct syntax: customer.metafields.custom.purchased_license_record.value
  • This allows proper iteration through the JSON array and access to nested properties

Status: Resolved - the user self-identified the solution immediately after posting.

Summarized with AI on October 31. AI used: claude-sonnet-4-5-20250929.

Hello,

I am trying to print out values from a JSON metafield but it does not work:

-JSON Schema :

{> “type”: “array”,> “items”: {> “type”: “object”,> “properties”: {> “license_id”: {> “type”: “string”,> “description”: “Unique ID of the license”> },> “product_name”: {> “type”: “string”,> “description”: “The name of the purchased product”> },> “expiry_date”: {> “type”: “string”,> “format”: “date”,> “description”: “The expiration date of the license (YYYY-MM-DD)”> }> },> “required”: [> “license_id”,> “product_name”,> “expiry_date”> ]> }> }

-Customer JSON values:

[> {> “license_id”: “12345”,> “product_name”: “Luminary Loud Pro”,> “expiry_date”: “2026-01-01”> },> {> “license_id”: “67890”,> “product_name”: “Luminary Loud Enterprise”,> “expiry_date”: “2027-05-15”> }> ]

Liquid :

{% assign licenses = customer.metafields.custom.purchased_license_record %}> > {% if licenses != blank %}> > > > > > > {% for license in licenses %}> > > > > > {% endfor %}>

License ID Product Expiry Date
{{ license.license_id }} {{ license.product_name }} {{ license.expiry_date }}

{% else %}>

No licenses found.

{% endif %}

Never mind !! Just add “.value” to “purchased_license_record” then I should be fine :slightly_smiling_face: