You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

修改Azure ARM虚拟网络参数后遇InvalidJson错误求助

Fixing the InvalidJson Error for Multiple Address Prefixes in Your ARM Template

Got it, let's break down why you're seeing that error and how to fix it quickly.

The Root Cause

You've correctly set up your addressPrefix parameter as an array of multiple CIDRs, but the way you're referencing it in the virtual network template is creating an invalid JSON structure. Here's what's happening:

  • Your parameter is an array:
    "parameters": { 
      "addressPrefix": { 
        "value": [ "10.18.0.0/17", "10.90.0.0/19" ] 
      },
      ...
    }
    
  • But in your template, you're wrapping this array parameter inside another set of brackets:
    "properties": { 
      "addressSpace": { 
        "addressPrefixes": [ "[parameters('addressPrefix')]" ] 
      },
      ...
    }
    

When the ARM template engine processes this, it replaces [parameters('addressPrefix')] with your array of CIDRs. That leaves you with:

"addressPrefixes": [ ["10.18.0.0/17", "10.90.0.0/19"] ]

The addressPrefixes property expects an array of strings, not an array containing another array. This mismatch is exactly what's causing the "Unexpected character encountered while parsing value: [" error.

The Simple Fix

Just remove the outer brackets around the parameter reference. Your corrected template section should look like this:

"properties": { 
  "addressSpace": { 
    "addressPrefixes": "[parameters('addressPrefix')]" 
  },
  ...
}

Now, when evaluated, addressPrefixes will directly be your array of CIDR strings, which fits the required schema perfectly.

Why It Worked for LocalNetworkGateways

My guess is that in your local network gateway template, you didn't wrap the parameter in those extra brackets. The localNetworkAddressSpace.addressPrefixes property also expects an array of strings, so using the parameter directly (without the outer []) was the correct approach there—same as what we're fixing here.

内容的提问来源于stack exchange,提问作者irom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.12 05:26:37