How to format JSON for Woocommerce REST API?

Hi there,

I am looking to patch info to orders on my Woocommerce store. The data are just a few comma separated image URLs scraped from an email with regex and I was looking to just put them into the meta_data array, so here is my API call:

… For which I would need to separate my info into individual values. However, the number of URLs isn’t consistent. Presumably I would have to make 10+ values and hope there’s no more than that many images. I’d rather have a more dynamic solution like so:


So my question is, how would you (modularly?) format the data into something that would work in this API? Here is my backend workflow:

Thanks in advance for any help!

When you work with an array (list), you need to use :format as text on a list.
Don’t try to put <key> into the value of another dynamic parameters.
Your meta data is correctly formatted. To initialize your call, provide a full value.
But once in composer, use a list with:format as text. But , as delimiter.
The format will look like {“key”:“this list picture key(dynamic)”,“value”:“this list picture value(dynamic)”}

1 Like