如何将JSON响应转换为Power BI中的表

发布于 2025-02-07 10:32:22 字数 1136 浏览 0 评论 0 原文

我是从Web服务中消费一些数据的任务,用于消耗来自Power BI的数据,我将其用作空白查询,稍后我在高级编辑器中添加了以下查询:

let
    url = "http://*********",
    headers= [#"Content-Type"="application/json"],
    postData = Text.ToBinary("{""token"":""*************""}"),
    response = Web.Contents(
        url,
        [
            Headers = headers,
            Content = postData           
        ]
    ),
    jsonResponse = Json.Document(response)
in
    jsonResponse

作为答案,我清楚地获得了一个JSON文件,该文件构成如下:

{'result':'1',
'message':'Successful Operation',
'data':[
{'idActivity':'1001', 
'organization':'ABC-001' ,
'date':'6/10/2022 2:34:04 PM',
'lat':'57.3497300',
'lng':'-90.3929000',
'status':'0',
'company':'382',
'tag':'0'},
{'idActivity':'1002', 
'organization':'DEF-002',
'date':'6/10/2022 2:21:15 PM',
'lat':'83.6718200',
'lng':'-23.3464000',
'status':'0',
'company':'932',
'tag':'0'}]}

我想知道是否有一种方法可以将此JSON文件转换为表,然后能够在Power BI Visuals中表示信息?

I am the task of consuming from a webservice some data by means of REST, for the consumption of data from Power BI I have used as a source a blank query where later I have added in the advanced editor the following query:

let
    url = "http://*********",
    headers= [#"Content-Type"="application/json"],
    postData = Text.ToBinary("{""token"":""*************""}"),
    response = Web.Contents(
        url,
        [
            Headers = headers,
            Content = postData           
        ]
    ),
    jsonResponse = Json.Document(response)
in
    jsonResponse

enter image description here

As an answer I have clearly obtained a JSON file which is composed as follows:

{'result':'1',
'message':'Successful Operation',
'data':[
{'idActivity':'1001', 
'organization':'ABC-001' ,
'date':'6/10/2022 2:34:04 PM',
'lat':'57.3497300',
'lng':'-90.3929000',
'status':'0',
'company':'382',
'tag':'0'},
{'idActivity':'1002', 
'organization':'DEF-002',
'date':'6/10/2022 2:21:15 PM',
'lat':'83.6718200',
'lng':'-23.3464000',
'status':'0',
'company':'932',
'tag':'0'}]}

I would like to know if there is a way to convert this JSON file to tables and then be able to represent the information in power bi visuals?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风启觞 2025-02-14 10:32:22

单击解析JSON按钮。那应该自动解析。您可能需要用双引号(“)替换单个引号

。 “ nofollow noreferrer”> “在此处输入图像描述”

Click the parse JSON button. That should parse it automatically. You might need to replace your single quotes with double quotes ("). Your sample JSON worked for me using parse JSON when I did that.

enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文