So the new shopify native metafields are awesome, and I see that it allows me to create a data type of JSON, but I’m having trouble accessing the JSON data in my theme code with liquid…
I created a new metafield called product.metafields.my_fields.foobar, and on a product I gave it a value of:
{
“color”: “blue”,
“age”: “12”,
“size”: “large”
}
In my product.liquid code, {{.product.metafields.my_fields.foobar }} will successfully print { “color”: “blue”, “age”: “12”, “size”: “large” } in the browser (as a string) but…
How can I access individual items? For example, how can I just print “blue” in the browser? I tried {{product.metafields.my_fields.foobar.color }} and {{product.metafields.my_fields.foobar[color]}} but those print nothing.
I’ve used the “accentuate” app in the past and the above method works perfectly. How can I achieve this with the shopify native metafields??