PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, July 25, 2022

[FIXED] How to convert JSON response to tables in Power BI

 July 25, 2022     json, powerbi, powerquery     No comments   

Issue

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?


Solution

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



Answered By - David
Answer Checked By - Senaida (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing