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
jcawley
Helper III
Helper III

Parsing Multi-Dimensional Array from json API?

 


So I need help trying to parse my json file from an API… I haven't been able to succesfully parse this into a table. I am receiving the following error:

"Expression.Error: We cannot convert a value of type Record to type Text.
Details:
Value=
379662=379662
396454=396454
396455=396455" ... etc etc

The function I am using looks like:

cap5.JPG

And the table:

yoyo.JPG


In the image above you can also see my table failing. I'm trying to get this information listed in a single table with each row being a seperate purchase ID.

Any help would be greatly appreciated!

1 ACCEPTED SOLUTION
Jimmy801
Community Champion
Community Champion

Hello @jcawley 

 

check out this solution. It converts the json to a table with two column, using the field "purchase_ids" from your api output

let
    YourJson = "{""total_found"":3, ""purchase_ids"":{""444636"":""444636"", ""444637"":""444637"", ""444638"": ""444638""}}",
    ReadJson = Json.Document(YourJson),
    CreateTable = Record.ToTable(ReadJson[#"purchase_ids"])
in
    CreateTable

Jimmy801_0-1612369081654.png

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

View solution in original post

2 REPLIES 2
jcawley
Helper III
Helper III

Also, here is an image from the webpage we are trying to parse the data from:

cap4.JPG

Jimmy801
Community Champion
Community Champion

Hello @jcawley 

 

check out this solution. It converts the json to a table with two column, using the field "purchase_ids" from your api output

let
    YourJson = "{""total_found"":3, ""purchase_ids"":{""444636"":""444636"", ""444637"":""444637"", ""444638"": ""444638""}}",
    ReadJson = Json.Document(YourJson),
    CreateTable = Record.ToTable(ReadJson[#"purchase_ids"])
in
    CreateTable

Jimmy801_0-1612369081654.png

 

Copy paste this code to the advanced editor in a new blank query to see how the solution works.

If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too

Have fun

Jimmy

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.

Top Solution Authors
Top Kudoed Authors