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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
g2ktcf
New Member

Parsing JSON is not giving all values

I am getting some odd behavior from attempting to expand a column with different JSON strings.  Each column can have different strings.  It appears that 

 

= Table.TransformColumns(#"Sorted Rows",{{"CustomFields", Json.Document}})

 

only grabs a certain number of records/rows.  I need it to see ALL of them.  We have sorted the table such that the problem row at 204 shows up at row 1, and everything works as expected.  But I have no control over where this record lies in production.  I am scratching my head here.  The image below is the newly sorted version.

g2ktcf_0-1708550138293.png

 

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @g2ktcf ,

Are you looking for output similar to this? Try unpivoting the expanded columns.

vcgaomsft_0-1708567875495.png

Advanced editor:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WUqiOUQpJLM52SSxJDcnMTTUyiVGyilEyMjAy0TUw0jU0CzEwsAIjPQMDgxglHTTlxijKjSwJKDdCVW6EprxWSUfJUClWJ1oJ6iy/sMQi54zEIhNTsEa4gTBxIwsLqEStAlCvEQV6jSnQa6IUGwsA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [CustomFields = _t, Column1 = _t]),
    #"Replaced Value" = Table.TransformColumnTypes(Source,{{"CustomFields", type text}, {"Column1", Int64.Type}}),
    #"Parsed JSON" = Table.TransformColumns(#"Replaced Value",{{"CustomFields", Json.Document}}),
    #"Expanded CustomFields" = Table.ExpandRecordColumn(#"Parsed JSON", "CustomFields", {"TaskDateTime24", "TaskDateTime23", "TaskDateTime22", "TaskNVarChar45", "TaskNVarChar288"}, {"TaskDateTime24", "TaskDateTime23", "TaskDateTime22", "TaskNVarChar45", "TaskNVarChar288"}),
    #"Unpivoted Columns" = Table.UnpivotOtherColumns(#"Expanded CustomFields", {"Column1"}, "Attribute", "Value")
in
    #"Unpivoted Columns"

If I misunderstood your question, could you tell me what your expected output is?

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum -- China Power BI User Group

I need each Attribute to be its own Field/Column.  I have reached out to my data source for a possible SQL solution.   I thought that the parsing was working...but it only brings in partials.

g2ktcf
New Member

Sorry, I have an error above...each ROW can have different JSON pairs.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.