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

Cómo recuperar datos de JOSN recursivo

Hola a todos

Tengo un archivo JOSN y los datos en él es como abajo.

{

"firstName": "Bidhan",

"lastName": "Chatterjee",

"edad": 40,

"dirección":

"streetAddress": "144 J B Hazra Road",

"city": "Burdwan",

"state": "Paschimbanga",

"postalCode": "713102"

},

"phoneNumber": [-

"type": "personal",

"number": "09832209761"

},

{

"type": "fax",

"number": "91-342-2567692"

}

]

}

Cuando estoy tratando de recuperar los datos del archivo estoy recibiendo el mensaje likw a continuación.

Capture.PNG

¿Puede alguien ayudarme aquí, cómo reintentar los datos de la dirección y el número de teléfono coumns.

Gracias

Anand

1 ACCEPTED SOLUTION
v-lili6-msft
Community Support
Community Support

hola @AnandNamburi

usted podría tratar de esta manera para recuperar datos

let
    Source = Json.Document(File.Contents("C:\Users\Desktop\new.json")),
    #"Converted to Table" = Record.ToTable(Source),
    #"Pivoted Column" = Table.Pivot(#"Converted to Table", List.Distinct(#"Converted to Table"[Name]), "Name", "Value"),
    #"Expanded address" = Table.ExpandRecordColumn(#"Pivoted Column", "address", {"streetAddress", "city", "state", "postalCode"}, {"streetAddress", "city", "state", "postalCode"}),
    #"Expanded phoneNumber" = Table.ExpandListColumn(#"Expanded address", "phoneNumber"),
    #"Expanded phoneNumber1" = Table.ExpandRecordColumn(#"Expanded phoneNumber", "phoneNumber", {"type", "number"}, {"type", "number"})
in
    #"Expanded phoneNumber1"

Resultado:

4.JPG

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-lili6-msft
Community Support
Community Support

hola @AnandNamburi

usted podría tratar de esta manera para recuperar datos

let
    Source = Json.Document(File.Contents("C:\Users\Desktop\new.json")),
    #"Converted to Table" = Record.ToTable(Source),
    #"Pivoted Column" = Table.Pivot(#"Converted to Table", List.Distinct(#"Converted to Table"[Name]), "Name", "Value"),
    #"Expanded address" = Table.ExpandRecordColumn(#"Pivoted Column", "address", {"streetAddress", "city", "state", "postalCode"}, {"streetAddress", "city", "state", "postalCode"}),
    #"Expanded phoneNumber" = Table.ExpandListColumn(#"Expanded address", "phoneNumber"),
    #"Expanded phoneNumber1" = Table.ExpandRecordColumn(#"Expanded phoneNumber", "phoneNumber", {"type", "number"}, {"type", "number"})
in
    #"Expanded phoneNumber1"

Resultado:

4.JPG

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
lbendlin
Super User
Super User

Esto no es recursivo, es sólo una jerarquía de varios niveles - de eso se trata JSON.

En Power Query, debe recorrer manualmente esa jerarquía y seleccionar los campos que desea convertir en una versión acoplada. No hay magia "dame todos los datos JSON en una tabla plana" botón, todo es trabajo manual.

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.