Can you have nested each with json variables

I am using Octopus 2020.1.0.
Is it possible to have nested #{each in var} loops using a json variable?

I would like to do something like this:
Given the json variable:
SiteDefinitions =

{
  "site1": { 
        {[
          {
            "targetHostName": "site1.com"
          }, 
          {
            "rootPath": "sitecore/content/Site1"
          }, 
          {
            "dictionaryDomain": "Site1"
          }
        ]}
      },
  "site2": { 
        {[
          {
            "targetHostName": "site2.com"
          }, 
          {
            "rootPath": "sitecore/content/Site2"
          }, 
          {
            "dictionaryDomain": "Site2"
          }
        ]}
    }
}

and the template:

  <sitecore>
    <sites>
	 #{each site in SiteDefinitions}
      <site name="#{site.Key}">
	   #{each attribute in site.Value}
        <patch:attribute name="attribute.Key">attribute.Value</patch:attribute>
	   #{/each}
      </site>
	 {#/each}
    </sites>
  </sitecore>
</configuration>

I would like the result to end up like this:

<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <sites>
      <site name="site1">
        <patch:attribute name="targetHostName">site1.com</patch:attribute>
        <patch:attribute name="rootPath">sitecore/content/Site1</patch:attribute>
        <patch:attribute name="dictionaryDomain">site1</patch:attribute>
      </site>
      <site name="site2">
        <patch:attribute name="targetHostName">site2.com</patch:attribute>
        <patch:attribute name="rootPath">sitecore/content/Site2</patch:attribute>
        <patch:attribute name="dictionaryDomain">site2</patch:attribute>
      </site>
    </sites>
  </sitecore>
</configuration>

So far it is not working. I have tried a couple of variations and none have worked.

Hi Daniel,

Thanks for the question!

This isn’t possible in the way you’ve mentioned right now. Would a variation on this solution work for you?

Thanks