Accessing values from a nested array in dynamic data

I have an ACF repeater custom field with a “file” type sub-field returning an array.

I can access the main values (url, filename etc) of the array just fine using:

I want to be able to access the thumbnail of my file, but this is buried in a sub-array of the returned value called “sizes”.


which is returned as a JSON string.

According to the dynamic data documentation:

“In cases where the value is a nested array, Bricks will flatten it as a JSON string to allow for seamless output without any errors.”

I can see that the data is being returned as a JSON string, but I have no idea how to output any part of this in my template.

Can someone please decipher this explanation for me and let me know how I can output values from this subarray in my template using dynamic data variables?

I can write PHP, but I’d rather stick with the Bricks variables if at all possible.


Apparently this isn’t possible using Bricks dynamic data.

All you get is the returned JSON string, which isn’t much use for extracting sub-array values.

I wrote a shortcode instead that takes the id and spits out the thumbnail using this code:

<a href="{acf_digital_purchase_download_links_download_file:array_value|url}" download>[display-thumbnail id="{acf_digital_purchase_download_links_download_file:array_value|id}" width="100" height" auto"]</a>

Reply to this post if you want me to share the code of my shortcode that I created.

Yes, of course, leave the code. It will be useful. But you could not register the shortcode, but simply create a function and display it as {echo:display-thumbnail}

Here’s the code.

Doing it solely as a function doesn’t allow me to pass parameters like size or class name, so a shortcode makes it more generally useful, rather than hardcoding these kinds of things.


	echo '<span class="' . $class . '">';
    echo $thumbnail;
	echo '</span>';
	$html = ob_get_contents();
	return $html;	

change to

return "<span class='{$class}'>{$thumbnail}</span>";


return '<span class="' . $class . '">' . $thumbnail . '</span>';

Thanks, but I wasn’t looking for feedback or help with my code.

I only shared it because you asked me to. I thought you wanted it to help you, not to tell me how to do it better.

That’s how I write my short codes and I’m happy with it thanks.

I won’t waste my time next time.

Your solution helped me. I’m sorry that a banal attempt to give recommendations to improve general knowledge is perceived as aggression.