If you’re trying to work with your azure ARM templates, specifically converting to and from JSON and you’re getting continual errors, try removing any comments from your template file.

Here is our template file:

{
     
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
     
"contentVersion": "1.0.0.0",
    
"parameters": {
      
"siteName": {
        
"type": "string",
        
"metadata": {
          
"description": "Name of azure web app"
        
}
      
},
      
"appServicePlanName": {
        
"type": "string",
        
"metadata": {
          
"description": "Name of hosting plan"
        
}
      
},
      
"sku": {
        
"type": "string",
        
"allowedValues": [
          
"Free",
          
"Shared",
          
"Basic",
          
"Standard",
          
"S1"
        
],
        
"defaultValue": "S1",
        
"metadata": {
          
"description": "SKU value"
        
}
      
},
      
"workerSize": {
        
"type": "string",
        
"allowedValues": [
          
"0",
          
"1",
          
"2"
        
],
        
"defaultValue": "0",
        
"metadata": {
          
"description": "Worker Size( 0=Small, 1=Medium, 2=Large )"
        
}
      
},
      
"use32bitWorkerProcess": {
        
"type": "bool",
        
"defaultValue": false,
        
"metadata": {
          
"description": "Enable 32bit worker process or 64bit, 64bit is not available if you choose free hosting plan."
        
}
      
},
      
"enableAlwaysOn": {
        
"type": "bool",
        
"defaultValue": false,
        
"metadata": {
          
"description": "Enable/Disable always on. If you choose free for hosting plan, this should be set to false as always on is not supported for free plan"
        
}
      
}
    
},
    
"resources": [
      
{
        
"apiVersion": "2016-09-01",
        
"name": "[parameters('appServicePlanName')]",
        
"type": "Microsoft.Web/serverfarms",
        
"location": "[resourceGroup().location]",
        
/\* Fluffy-duck \*/
        
"sku": {
          
"name": "[parameters('sku')]",
          
"capacity": "[parameters('workerSize')]"
        
},
        
"properties": {
          
"name": "[parameters('appServicePlanName')]"
        
}
      
},
      
{
        
"name": "[parameters('siteName')]",
        
"type": "microsoft.Web/sites",
        
"apiversion": "2016-08-01",
        
"location": "[resourceGroup().location]",
        
"dependsOn": [
          
"[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]"
        
],
        
"properties": {
          
"name": "[parameters('siteName')]",
          
"serverFarmId": "[parameters('appServicePlanName')]"
        
},
        
"resources": [
          
{
            
"apiVersion": "2016-08-01",
            
"name": "web",
            
"type": "config",
            
"dependsOn": [
              
"[resourceId('Microsoft.Web/serverfarms', parameters('appServicePlanName'))]",
              
"[resourceId('Microsoft.Web/sites', parameters('siteName'))]"
            
],
            
"properties": {
              
"phpVersion": "off",
              
"netFrameworkVersion": "v4.5",
              
"use32BitWorkerProcess": "[parameters('use32bitWorkerProcess')",
              
"webSocketsEnabled": true,
              
"alwaysOn": "[parameters('enableAlwaysOn')]",
              
"requestTracingEnabled": true,
              
"httpLoggingEnabled": true,
              
"logsDirectorySizeLimit": 40,
              
"detailedErrorLoggingEnabled": true,
              
"scmType": "LocalGit",
              
"appSettings": [
                
{
                  
"Name": "SCM\_SITEEXTENSIONS\_FEED_URL",
                  
"Value": "http://www.siteextensions.net/api/v2/"
                
}
              
]
            
}
          
}
        
]
      
}
    
]
  
}
  

When running convertfrom-json, you can these errors:

  
ConvertFrom-Json : Invalid object passed in, ':' or '}' expected. (1685):
  
{
     
"$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
     
"contentVersion": "1.0.0.0",
    
"parameters": {
      
"siteName": {
  

The (1685) is which character had your issue. Put your JSON file into a variable, and perform the “substring” method:

  
$substr = (get-content .\base-web-svc-template.json|out-string)
  
$substr.Substring(1688)

nimal": "Fluffy-Duck",*/
        
"sku": {
          
"name": "[parameters('sku')]",
          
"capacity": "[parameters('workerSize')]"
        
},
        
"properties": {
          
"name": "[parameters('appServicePlanName')]"
        
}
  

THis shows us our comment had the issue. Once removed, convert-fromjson worked fine.