title: Cannot deserialize JSON array into type 'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Templates.Schema.TemplateResourceCopy'
body: <p>The aim of the template is to add subnets to an existing Vnet but when executing it using the powershell command</p>
  
  <pre><code>   New-AzureRmResourceGroupDeployment -Name testing -ResourceGroupName rgname -TemplateFile C:\Test\deploy.json -TemplateParameterFile C:\Test\parameterfile.json
  </code></pre>
  
  <p>The following error is displayed and I really cant understand what it means.Here is the error <strong>*
  "Error: Code=InvalidRequestContent; Message=The request content was invalid and could not be deserialized: 'Cannot populate JSON 
  array ontotype'Microsoft.WindowsAzure.ResourceStack.Frontdoor.Templates.Schema.TemplateResourceCopy'. Path 'properties.template.resources[0].copy' "*</strong></p>
  
  <p>Following is my input file(parameter.json)</p>
  
  <pre><code>    {
       "VNetSettings":{
       "value":{
          "name":"VNet2",
          "addressPrefixes":"10.0.0.0/16",
          "subnets":[
              {
                  "name": "sub5",
                  "addressPrefix": "10.0.5.0/24"
              },
              {
                  "name":"sub6",
                  "addressPrefix":"10.0.6.0/24"
              }
          ]
      }
    }
  }
  </code></pre>
  
  <p>The following is my template(deploy.json)</p>
  
  <pre><code>   {
      "contentversion":"1.0.0.0",
      "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
      "parameters":{
          "VNetSettings":
                     {"type":"object"},
          "noofsubnets":
            {
              "type":"int"
            }
      },
  "resources":
  [
  {
      "type":"Microsoft.Network/virtualNetworks/subnets",
      "apiVersion": "2015-06-15",
      "location":"[resourceGroup().location]",
      "copy": [
        {
          "name":"subnets",
          "count":"[parameters('noofsubnets')]",
          "input": {
               "name": "[concat(parameters('VNetSettings').name, '/',parameters('VNetSettings').subnets[copyIndex('subnets')].name)]",                
               "properties":{
                   "addressPrefix": "[parameters('VNetSettings').subnets[copyIndex('subnets')].addressPrefix]"
                  }
               }
            }
         ]
        }
     ]
  }
  </code></pre>
  
  <p>I guess the error should be in and around the copy statement.</p>