cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Load JSON as source via Python

I'm trying to get the JSON from Python as Source in the Query Editor:

 

let
    Source = Python.Execute("import urllib.request, json #(lf)with urllib.request.urlopen(""https://api.pipedrive.com/v1/organizations?start=0&limit=50&api_token=MyVerySecretGUID"") as url:#(lf)    data = json.loads(url.read().decode())#(lf)    print(data)"),
    data = Source,
    #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"id", "name"}, {"Column1.id", "Column1.name"})
in
    #"Expanded Column1"

Tried different variations without the converting to table steps. But the Source step does not even returns the respronse. 

Which format does Power BI want to be delivered? Tried print, clean JSON everything even to get the child items out of the JSON nothing works...

 

The Python code returns the JSON directly:

import urllib.request, json 
with urllib.request.urlopen("https://api.pipedrive.com/v1/organizations?start=0&limit=50&api_token=MyVerySecretGUID") as url:
    data = json.loads(url.read().decode())
    print(data)

 

p.s. yes I know I can get the JSON directly as source, but I want to loop trough all records provided and no user actions needs to be involved(like the Parameters/Invoked function). That's why im trying to do it via Python. 

 

Am I doing something wrong here?

 

10 REPLIES 10
Highlighted

@Laho - thanks for sharing, I'll give it a try!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Community Conference

Microsoft Power Platform Communities

Check out the Winners!

secondImage

Create an end-to-end data and analytics solution

Learn how Power BI works with the latest Azure data and analytics innovations at the digital event with Microsoft CEO Satya Nadella.

Top Solution Authors
Top Kudoed Authors