Hierarchy issues JSON-file in Azure Synapse Analytics (Data Factory).

%3CLINGO-SUB%20id%3D%22lingo-sub-1744764%22%20slang%3D%22en-US%22%3EHierarchy%20issues%20JSON-file%20in%20Azure%20Synapse%20Analytics%20(Data%20Factory).%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1744764%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%20all%20I%20am%20working%20with%20XML%20files%20that%20I%20unzip%20and%20then%20convert%20to%20a%20JSON%20(because%20a%20XML%20file%20is%20sink%20only).%20I%20will%20then%20use%20the%20JSON%20file%20in%20Data%20Factory%20to%20flatten%20the%20data%20in%20relevant%20datasets%20that%20I%20write%20away%20to%20CSV%20files%20on%20my%20data%20lake.%20To%20standardize%20this%20process%20I%20created%20my%20own%20standardized%20JSON%20file%20for%20my%20hierarchy%20that%20I%20use%20in%20the%20projection.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20issue%20I%20am%20running%20into%20is%20that%20I%20cannot%20drill%20through%20the%20entire%20hierarchy%20of%20the%20JSON%20file.%20So%20I%20assumed%20the%20problem%20was%20my%20own%20standardized%20hierarchy%20so%20I%20let%20Synapse%20analytics%20create%20its%20own%20hierarchy%20to%20fix%20this%20issue.%20This%20resulted%20in%20the%20following%20two%20hierarchies%3A%20Own%20hierarchy.PNG%20and%20Synpase%20hierarchy.PNG.%3C%2FP%3E%3CDIV%20class%3D%22lia-attachment-file-details%22%3E%3CDIV%20class%3D%22lia-attachment-file-size%22%3E%26nbsp%3B%3C%2FDIV%3E%3C%2FDIV%3E%3CP%3EWhen%20I%20previewed%20the%20two%20hierarchies%20my%20own%20hierarchy%20created%20all%20needed%20columns%20however%20all%20data%20after%20Journal%20was%20empty.%20When%20looking%20at%20the%20automatically%20created%20hierarchy%20it%20didn%E2%80%99t%20create%20any%20of%20the%20columns%20after%20journal%20and%20created%20Transaction%20as%20a%20string%20with%20all%20the%20data%20after%20journal%20in%20that%20one%20column%20(%3CSPAN%3EPreview%20Synapse%20hierarchy.PNG%3C%2FSPAN%3E).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20when%20I%20compared%20different%20JSON%20files%20some%20of%20them%20did%20correctly%20unpack%20the%20data.%20The%20only%20difference%20between%20these%20datasets%20is%20the%20first%20path%20of%20the%20hierarchy.%20As%20shown%20here%20below%20the%20first%20dataset%20(%3CSPAN%3EJSON%20File%20Customer%20Journal.PNG%3C%2FSPAN%3E)%20shows%20a%20JSON%20file%20that%20will%20not%20unpack%20the%20data%20further%20than%20the%20journal.%20The%20second%20dataset%20(%3CSPAN%3EJSON%20File%20Customer%20Transaction.PNG%3C%2FSPAN%3E)%20will%20unpack%20the%20transaction%20just%20not%20the%20trline.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ESo%20the%20problem%20is%20the%20way%20Azure%20Synapse%20Analytics%20reads%20the%20JSON-file.%20I%20have%20no%20clue%20how%20to%20fix%20this%20issue%20and%20was%20wondering%20if%20any%20of%20you%20could%20help%20me%20solve%20this%20issue.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20reading%20my%20post%20and%20hopefully%20you%20can%20help%20me%20out.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ELars%20%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hello, all I am working with XML files that I unzip and then convert to a JSON (because a XML file is sink only). I will then use the JSON file in Data Factory to flatten the data in relevant datasets that I write away to CSV files on my data lake. To standardize this process I created my own standardized JSON file for my hierarchy that I use in the projection.

 

The issue I am running into is that I cannot drill through the entire hierarchy of the JSON file. So I assumed the problem was my own standardized hierarchy so I let Synapse analytics create its own hierarchy to fix this issue. This resulted in the following two hierarchies: Own hierarchy.PNG and Synpase hierarchy.PNG.

 

When I previewed the two hierarchies my own hierarchy created all needed columns however all data after Journal was empty. When looking at the automatically created hierarchy it didn’t create any of the columns after journal and created Transaction as a string with all the data after journal in that one column (Preview Synapse hierarchy.PNG).

 

So when I compared different JSON files some of them did correctly unpack the data. The only difference between these datasets is the first path of the hierarchy. As shown here below the first dataset (JSON File Customer Journal.PNG) shows a JSON file that will not unpack the data further than the journal. The second dataset (JSON File Customer Transaction.PNG) will unpack the transaction just not the trline.

 

So the problem is the way Azure Synapse Analytics reads the JSON-file. I have no clue how to fix this issue and was wondering if any of you could help me solve this issue.

 

Thank you for reading my post and hopefully you can help me out.

 

Lars  

0 Replies