我已经完成了之前所有与此问题相关的解决问题,但它仍然给我同样的错误,
我想拉json数组" StringValidator"在下面给出的例子中出现
{
key: "AppsIds",
collectionValidator: {
key: "AppIds",
value: "bdff7f25d162f433539a3426fc979384,bdff7f25d162f433539a3426fc979384",
delimiter: ",",
minInclusive: 1,
maxInclusive: 20,
stringValidators: [
{
value: "bdff7f25d162f433539a3426fc979384",
key: "AppIds",
regex: "[a-fA-F0-9]{32}",
minLength: 32,
maxLength: 32
},
{
value: "bdff7f25d162f433539a3426fc979384",
key: "AppIds",
regex: "[a-fA-F0-9]{32}",
minLength: 32,
maxLength: 32
}
]
}
}
任何人都可以帮助我,我是json的新手
答案 0 :(得分:0)
我用双引号包围了你所有的键,jsonlist.com验证器似乎对此感到满意。只需访问该网站并复制/粘贴下面更新的json对象。
此外,这里是迭代JSON密钥对的一个很好的参考:https://coderwall.com/p/_kakfa/javascript-iterate-through-object-keys-and-values
例如:
var resultJSON = '{"FirstName":"John","LastName":"Doe","Email":"johndoe@johndoe.com","Phone":"123 dead drive"}';
var data = JSON.parse(resultJSON);
for (var key in data)
{
//console.log(key + ' : ' + data[key]);
alert(key + ' --> ' + data[key]);
}

{
"key": "AppsIds",
"collectionValidator": {
"key": "AppIds",
"value": "bdff7f25d162f433539a3426fc979384,bdff7f25d162f433539a3426fc979384",
"delimiter": ",",
"minInclusive": 1,
"maxInclusive": 20,
"stringValidators": [
{
"value": "bdff7f25d162f433539a3426fc979384",
"key": "AppIds",
"regex": "[a-fA-F0-9]{32}",
"minLength": 32,
"maxLength": 32
},
{
"value": "bdff7f25d162f433539a3426fc979384",
"key": "AppIds",
"regex": "[a-fA-F0-9]{32}",
"minLength": 32,
"maxLength": 32
}
]
}
}