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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
sedrani
Regular Visitor

Cannot seem to figure out this JSON structure

I'm trying to build a specific table out of a specific JSON API but can't seem to figure it out with this specific structure.

https://api.opencorporates.com/v0.4/jurisdictions

It lists all the jurisdictions they have and I want to get them in excel in the following structure

 

code1 name1 country1 full_name1

code2 name2 country2 full-name2

etc...

 

IF anyone could figure out what's wrong with this code?

let
    Source = Json.Document(Web.Contents("https://api.opencorporates.com/v0.4/jurisdictions")),
    results = Source[results],
    jurisdictions1 = results[jurisdictions],
    #"Converted to Table" = Record.ToTable(jurisdictions1),
    #"Expanded Value" = Table.ExpandListColumn(#"Converted to Table", "Value"),
    #"Expanded Value1" = Table.ExpandRecordColumn(#"Expanded Value", "Value", {"code", "name", "country"})
in
    #"Expanded Value1"
1 ACCEPTED SOLUTION
sedrani
Regular Visitor

Never mind

 

Found it myself

let
    Source = Json.Document(Web.Contents("https://api.opencorporates.com/v0.4/jurisdictions")),
    results = Source[results],
    jurisdictions1 = results[jurisdictions],
    #"Converted to Table" = Table.FromList(jurisdictions1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"jurisdiction"}, {"Column1.jurisdiction"}),
    #"Expanded Column1.jurisdiction" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.jurisdiction", {"code", "name", "country", "full_name"}, {"Column1.jurisdiction.code", "Column1.jurisdiction.name", "Column1.jurisdiction.country", "Column1.jurisdiction.full_name"})
in
    #"Expanded Column1.jurisdiction"

View solution in original post

1 REPLY 1
sedrani
Regular Visitor

Never mind

 

Found it myself

let
    Source = Json.Document(Web.Contents("https://api.opencorporates.com/v0.4/jurisdictions")),
    results = Source[results],
    jurisdictions1 = results[jurisdictions],
    #"Converted to Table" = Table.FromList(jurisdictions1, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"jurisdiction"}, {"Column1.jurisdiction"}),
    #"Expanded Column1.jurisdiction" = Table.ExpandRecordColumn(#"Expanded Column1", "Column1.jurisdiction", {"code", "name", "country", "full_name"}, {"Column1.jurisdiction.code", "Column1.jurisdiction.name", "Column1.jurisdiction.country", "Column1.jurisdiction.full_name"})
in
    #"Expanded Column1.jurisdiction"

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors