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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
lbg-sage
Regular Visitor

Fix errors in PBI dataflow from exported JSON files

I am using Microsoft Fabric Data pipelines to export JSON files into a dataflow using an API connection.

 

The output of the "Copy Data Activity" exports the data as a JSON file to a Bronze Lakehouse. This "Copy Data Activity" includes the Pagination rules shown in the attached image below.

 

PaginationRules_bw.png

 

The Bronze Lakehouse is the datasource for the Dataflow. The pipeline runs successfully up until I attempt to transform in Power Query within the dataflow. 

 

The error from the dataflow is as follows

lbgsage_0-1708004810966.png

The transform file source shows the JSON export to be split like this, which I imagine is what is causing the error. 

lbgsage_1-1708004866797.png

Power query isn't formatting the JSON output correctly as the JSON files aren't separated by each row. This would explain the character error shown above.  

 

Could you please help me figure out how to correctly format the JSON outputs in my power bi dataflow and/or the fabric data pipeline? 

 

Thank you!

 

5 REPLIES 5
lbg-sage
Regular Visitor

Hey @v-shex-msft Fix errors in PBI dataflow from exported JSON files  any ideas for this one? Still struggling to remove the error. If you have any advice it would be hugely appreciated. I have tried to explain as much as possible above, but please let me know if there is any further information you require and I will do my best to fill in the gaps. 

 

Thank you in advance for your help!

L

lbg-sage
Regular Visitor

Hello, 

 

Thank you for getting back to me, and apologies for my delay in responding. 

 

I am working on extracting social media marketing data for a software company and their competitor companies, using the Brandwatch platform. I am using an consumer research API (Getting Started (brandwatch.com)) in fabric data pipelines following a very similar logic to that within this article Martin's Blog - Working with OAuth 2.0 APIs in Azure Data Factory: Refreshing tokens (martinschoombe...

The below screencap shows the pipeline and a series of web connection/set variable steps using the guidance from the brandwatch.com link, that eventually results in JSON file outputs, which I save into a Bronze Lakehouse, and then into a power bi dataflow for consumption. 

lbgsage_6-1709331338018.png

  1. I use the pipeline expression builder to extract the username and password (stored as variables) to get the OAuth token for the API connection. This is then set as a variable in the next step of the pipelinelbgsage_2-1709330535764.png
  2. I then use the oauth variable set in step 1 to get the project summary using the relative URL in the settings.lbgsage_3-1709330792278.png

     

  3. From step 2 I then follow the guidance set out in the Brandwatch.com documentation to get the specific queries that I want from the project. This again is via relative URL links and the oauth variable set in step 1, and the project_id gained from step 2.lbgsage_4-1709331060975.png

  4. The specific query names that I want to obtain from the project are static named string variables (filter_array) which I use as dynamic content in the relative url in the "Filter to specific queries" activity step. I filter the results from the previous web step based on the filter array variable. lbgsage_5-1709331242744.png

     

  5. From this I then use a For Each activity using the output of step 4 (filter to specific queries). This contains 4 activities within it (3x set variables and 1x copy data).
  6. I set the query_id and query_name based on the output from the previous steps using @string(item().id) and 
    @string(item().name) respectively. The mention_request_url is set following the url link structure in the brandwatch.com guidance documentation, using the project_id, query_id, start and end_date variables I have set in previous steps and '&pageSize=800' as this is the optimum amount of page size I can use without timeout error on the API. I know this from trial and error when running the pipeline.  lbgsage_7-1709331768246.png
  7. The copy data activity then uses the output of the mention_request_url variable and a series of advanced factors as shown in the screencap. I believe this may be where I am getting the error due to the pagination rules used to split the JSON files, but I am not 100% sure.lbgsage_8-1709331938662.png

    At the end of the JSON output, there is a nextCursor. The pagination rules in my pipeline use this nextCursor from the previous JSON file from the output of the copy data steps to start off the next lot of pagination, and the EndCondition is when the $nextCursor of the JSON output is blank. Please see the screencap below for an example of this 

    lbgsage_9-1709332237305.png

     

  8. The problem arises when I then take the output of the JSON file extractions into the Bronze Lakehouse and put this in a dataflow. I recieve this error when loading the power BI dataflow. lbgsage_10-1709332352995.png

    I can see from the JSON output that the JSON file doesn't end how PBI would expect it to to be able to correctly format the JSON. I imagine this might be where the error is coming from, but I am not sure. 

    lbgsage_11-1709332456978.png

Please could you help me understand what I need to do either in the data pipeline or in the dataflow to correctly format the JSON output? Thank you in advance for your help, and I hope this is enough detail to help you understand my problem. 

 

Thanks again! 

L

 

v-shex-msft
Community Support
Community Support

Hi @lbg-sage ,

Can you please share some more detail information about this issue? They should help us clarify your scenario and test to troubleshoot.

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Hey @v-shex-msft - any ideas on this one?

Hello 

 

Have you had a chance to look at the additional information I have provided above? 

 

Thanks,

L

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

Check out the June 2024 Power BI update to learn about new features.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.