我正在使用powerautomatic从Egnyte API中提取一些Json数据。Power Automate通过示例查询生成架构。问题是它生成的查询不会对所有查询都起作用,因为它会将类型设置为";字符串";并且一些空值将出现在一些查询中。我需要将所有类型从";字符串";到["string","null"]?这似乎是Power automatic应该为类型自动执行的操作。
这是错误消息的一部分。
"message": "Invalid type. Expected String but got Null.",
这是模式。
{
"properties": {
"itemsPerPage": {
"type": "integer"
},
"resources": {
"items": {
"properties": {
"active": {
"type": "boolean"
},
"authType": {
"type": "string"
},
"createdDate": {
"type": "string"
},
"deleteOnExpiry": {
},
"email": {
"type": "string"
},
"emailChangePending": {
"type": "boolean"
},
"expiryDate": {
},
"externalId": {
"type": "string"
},
"id": {
"type": "integer"
},
"idpUserId": {
"type": "string"
},
"isServiceAccount": {
"type": "boolean"
},
"lastActiveDate": {
"type": "string"
},
"lastModificationDate": {
"type": "string"
},
"locked": {
"type": "boolean"
},
"name": {
"properties": {
"familyName": {
"type": "string"
},
"formatted": {
"type": "string"
},
"givenName": {
"type": "string"
}
},
"type": "object"
},
"role": {
"type": "string"
},
"userName": {
"type": "string"
},
"userPrincipalName": {
},
"userType": {
"type": "string"
}
},
"required": [
"id",
"userName",
"externalId",
"email",
"name",
"active",
"locked",
"emailChangePending",
"authType",
"userType",
"role",
"idpUserId",
"userPrincipalName",
"expiryDate",
"deleteOnExpiry",
"createdDate",
"lastModificationDate",
"lastActiveDate",
"isServiceAccount"
],
"type": "object"
},
"type": "array"
},
"startIndex": {
"type": "integer"
},
"totalResults": {
"type": "integer"
}
},
"type": "object"
}
很快解析json操作应该能够处理null值。
此功能预计将于本月正式推出:https://learn.microsoft.com/en-gb/power-platform-release-plan/2022wave2/power-automate/parse-json-action-now-handles-null-objects
在我的例子中,将所有实例从";类型":"字符串";至";类型":["string"、"null"]确实解决了这个问题。它允许Power Automate JSON处理在没有空值错误的情况下工作。