我已经成功地将所有的用户数据存储在一个数组中(请见这里),但现在我无法循环遍历数据。在构建了数组后,我已将其转换为JSON,但我不能再按照JSON模式中定义的字段进行访问。
在循环遍历中,我只能访问JSON主体而不是像用户名、邮箱等单独字段。
我应该改变我的JSON模式来解决这个问题,还是有其他问题需要解决?
编辑:请查看我的JSON模式如下:
请查看以下图片,了解JSON的格式:
在循环遍历中,我只能访问JSON主体而不是像用户名、邮箱等单独字段。
我应该改变我的JSON模式来解决这个问题,还是有其他问题需要解决?
编辑:请查看我的JSON模式如下:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"items": [
{
"properties": {
"@@odata.type": {
"type": "string"
},
"createdDateTime": {
"type": "string"
},
"employeeId": {
"type": "string"
},
"givenName": {
"type": "string"
},
"id": {
"type": "string"
},
"mail": {
"type": "string"
},
"onPremisesSamAccountName": {
"type": "string"
},
"surname": {
"type": "string"
},
"userPrincipalName": {
"type": "string"
}
},
"required": [
"@@odata.type",
"id",
"givenName",
"surname",
"userPrincipalName",
"mail",
"onPremisesSamAccountName",
"employeeId",
"createdDateTime"
],
"type": "object"
}
],
"type": "array"
}
请查看以下图片,了解JSON的格式: