gpt4 book ai didi

json - Azure 逻辑应用解析 Json 引发错误

转载 作者:行者123 更新时间:2023-12-03 04:49:53 24 4
gpt4 key购买 nike

背景

我有一个返回 JSON 响应的自定义连接器。我正在尝试解析 JSON 响应,因为我想稍后在其他流程中使用该响应。因此,我正在使用数据操作连接器中的解析 JSON 操作。以下是 JSON 响应和我提供给 Parse 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 响应

最佳答案

看起来使用示例负载生成架构无法生成正确的架构。所以你可以去这个 liquid studio site 并粘贴 JSON 负载,然后单击生成架构按钮,然后您将获得 Json 架构。

enter image description here

我测试了架构,它运行得很好。 enter image description here

希望这可以帮助您,如果您还有其他问题,请告诉我。

关于json - Azure 逻辑应用解析 Json 引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54791710/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com