How to Update JSON Metafields in Flow After Run Code Output With Liquid Limitations?

Hi everyone, what do you recommend for this issue. I need to update a JSON metafield after calling Run Code in Flow. The Run Code then return the updated data, and i would like to insert this new data in the JSON metafield. However, due to the limitation below, i cannot see another alternative then knowing and hard-coding my object keys - and pass its values. I was trying to have a loop over its keys and automate the output, but does not seems to be possible loop object keys in Liquid.

Due to the limitation of:

The ability to directly output objects is no longer supported. In order to make changes to this workflow, please specify the fields you need to use. For more information, check out: https://help.shopify.com/en/manual/shopify-flow/reference/variables#complex-data-objects-in-shopify-flow

Serialize your JSON to a string in Run code using something like JSON.stringify(your_variable). Then simply output the string in the update metafield action {{your_outputted_variable}}.

2 Likes