背景
我有一个自定义连接器,它返回一个JSON响应。我正在尝试解析对JSON的响应,因为我想稍后在其他流程中使用响应。这样我就可以使用来自数据操作连接器的Parse JSON Action。以下是我提供给Parse JSON的JSON响应和JSON模式。
响应
[
[
{
"key":"Customer_Key",
"value":{
"id":"abfa48ad-392d-e511-80d3-005056b34214",
"name":"90033"
}
},
{
"key":"Status",
"value":"Done"
}
]
]
架构
{
"type": "array",
"items": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
},
"required": [
"key",
"value"
]
}
}
}
例外
{
"message": "Invalid type. Expected Object but got String.",
"lineNumber": 0,
"linePosition": 0,
"path": "[0][2].value",
"value": "90033",
"schemaId": "#/items/items/properties/value",
"errorType": "type",
"childErrors": []
},
任何人都知道这个问题是什么?我们怎样才能转换上面的json响应
看起来Use sample payload to generate schema
无法生成正确的架构。因此,您可以转到此liquid studio site并粘贴JSON有效负载,然后单击Generate Schema按钮,然后您将获得Json Schema。
希望这可以帮到你,如果你还有其他问题,请告诉我。
架构看起来不正确。尝试使用以下架构:
{
"type": "array",
"items": [
{
"type": "array",
"items": [
{
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
}
},
"required": [
"id",
"name"
]
}
},
"required": [
"key",
"value"
]
},
{
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
},
"required": [
"key",
"value"
]
}
]
}
]
}