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
mukuljp
Frequent Visitor

Transform json list of record with dynamic keys to table

I'm getting a JSON response from an m-query with below format

 

 

 

 

const json = [
{
"id":"a",
"values":{"c":1,"d":"2","e":"3"}
},
{
"id":"b",
"values":{"f":4,"g":"5","h":"6"}
}
]

 

 

 

 

I want to convert this to table like below,

idkeyvalue
ac1
ad2
ae3
bf4
bg5
bh6

Can any one redirect me to a sample m query to transofm dynamic key value json objects maps

1 ACCEPTED SOLUTION
DataVitalizer
Super User
Super User

Hi @mukuljp 

 

After connecting your Json file, open the powerquery editor and follow these steps:

  1. Right select the column "id" and click Unpivot other columns
  2. Right Click second column "Attribute" and replace Values. by none

Did it work ? 👌 Mark it as a solution to help spreading knowledge 👉 A kudos would be appreciated

View solution in original post

2 REPLIES 2
mukuljp
Frequent Visitor

@DataVitalizer This works, Thanks for sharing

DataVitalizer
Super User
Super User

Hi @mukuljp 

 

After connecting your Json file, open the powerquery editor and follow these steps:

  1. Right select the column "id" and click Unpivot other columns
  2. Right Click second column "Attribute" and replace Values. by none

Did it work ? 👌 Mark it as a solution to help spreading knowledge 👉 A kudos would be appreciated

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.