在我的管道中,我使用GET请求通过REST API来访问第三方数据库。作为输出,我收到了一堆JSON文件。我必须下载的JSON文件数(与我将要使用的迭代数相同)在JSON文件的字段之一中。问题在于该字段的名称为'page-count',其中包含“-”。
@activity('Lookup1').output.firstRow.meta.page.page-count
数据工厂将字段名称中的破折号视为减号,因此我从该字段中收到错误而不是值。
{"code":"BadRequest","message":"ErrorCode=InvalidTemplate, ErrorMessage=Unable to parse expression 'activity('Lookup1').output.firstRow.meta.page.['page-count']'","target":"pipeline/Product_pull/runid/f615-4aa0-8fcb-5c0a144","details":null,"error":null}
这是JSON文件的结构:
"firstRow": {
"meta": {
"page": {
"number": 1,
"size": 1,
"page-count": 7300,
"record-count": 7300
},
"non-compliant-record-count": 7267
}
},
"effectiveIntegrationRuntime": "intergrationRuntimeTest1",
"billingReference": {
"activityType": "PipelineActivity",
"billableDuration": [
{
"meterType": "SelfhostedIR",
"duration": 0.016666666666666666,
"unit": "Hours"
}
]
},
"durationInQueue": {
"integrationRuntimeQueue": 1
}
}
如何解决此问题?
下面的语法在检索带有连字符的json元素的值时起作用。否则,解析器会将其视为减号。它似乎没有被Microsoft记录下来,但是我设法通过我的一个项目的反复试验使它起作用。