简体   繁体   English

Azure数据工厂V2-解析JSON HTTP GET数据集

[英]Azure Data Factory V2 - Parsing JSON HTTP GET Dataset

I am trying to consume the API response below using the HTTP GET connector in Azure Data Factory V2. 我正在尝试使用Azure Data Factory V2中的HTTP GET连接器使用下面的API响应。 I am unable to get the Dataset properly parsed and I keep getting an error that the activity failed during deserialization as the data is not in proper JSON object nor array format. 我无法正确解析数据集,并且由于数据既不是正确的JSON对象也不是数组格式,所以我不断收到错误消息,表明反序列化期间活动失败。

I have tried to leverage JSONPath to isolate specific key-value pairs but I keep getting the same error. 我试图利用JSONPath来隔离特定的键值对,但是我仍然遇到相同的错误。 I have successfully done this with many other APIs but can't seem to figure this one out. 我已经使用许多其他API成功完成了此操作,但似乎无法弄清楚这一点。 Ultimately, I just want to create a table with a column date, and another one for Revenue, another one for Cost of Revenue, and so on. 最终,我只想创建一个带有列日期的表,另一个用于收入,一个用于收入成本,依此类推。

Any ideas on the best way to parse this API response using Azure Data Factory V2? 关于使用Azure Data Factory V2解析此API响应的最佳方法的任何想法? Thanks in advance. 提前致谢。

 {
     "AAPL": {
         "Revenue": {
             "2013-09": "170910",
             "2014-09": "182795",
             "2015-09": "233715",
             "2016-09": "215639",
             "2017-09": "229234",
             "TTM": "239176"
         },
         "Cost of revenue": {
            "2013-09": "106606",
            "2014-09": "112258",
            "2015-09": "140089",
            "2016-09": "131376",
            "2017-09": "141048",
            "TTM": "147254"
         }
     } 
}

I think your issue is more of a data structure nature. 我认为您的问题更多的是数据结构性质。 The JSON format used when importing can be used with the jsonPathDefinition parameter to map paths as columns, the thing is, the formatter cannot perform a correlation between an item under Revenue and an item under Cost of revenue (meaning take item index 0 from both locations and create a single row for them). 导入时使用的JSON格式可以与jsonPathDefinition参数一起使用,以将路径映射为列,事实是,格式化程序无法在Revenue(收入)下的项目与Revenue Cost(收入成本)下的项目之间执行关联(这意味着从两个位置获取项目索引0并为其创建一行)。

I think you'll need to due some custom pre-processing on the JSON file before importing. 我认为您需要在导入之前对JSON文件进行一些自定义的预处理。

Hope it helps! 希望能帮助到你!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM