SyntaxError:JSON.parse错误:main位置2处的无效字符 (脚本代码:21:1)
我正在为未来的广告系列预算脚本测试这部分代码。
function main() {
var bingClientsRaw = '{
"AccountId": 1258176,
"campaignName": "00001-02 English Parts General v3.3 - SearchNetwork",
"budgetValue": 0.06
},
{
"AccountId": 1259866,
"campaignName": "00045-02 Jim Ellis Saab General v3.3 - SearchNetwork",
"budgetValue": 0.67
},
{
"AccountId": 2610918,
"campaignName": "00019 - Part Number 001",
"budgetValue": 0.06
}';
bingClients = JSON.parse(bingClientsRaw);
var accounts = AccountsApp.accounts()
.withIds([ "bingClients.AccountId" ])
.get();
while (accounts.hasNext()) {
var account = accounts.next();
Logger.log(`${account.getName()}`);
}
}
此代码假定从我的JSON中迭代3个帐户并显示帐户名称。