Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Laho
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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.