The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event! Join us in Stockholm, Sweden from September 24-27, 2024.
2-for-1 sale on June 20 only!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
Hi everyone
We access a table containing a JSON column with the Power BI connector for SQL Warehouse cluster in Databricks.
The field looks like this in Databricks (complex datatype):
[{"key":"FOO","label":"FOOBAR","value":"ABC 54\""},{...}]
It also looks like that when we connect to the same SQL Warehouse cluster with Python.
However, in Power BI it looks like this (string). The escape character \ is missing:
[{"key":"FOO","label":"FOOBAR","value":"ABC 54""},{...}]
This leads to an error when we try to parse this JSON.
There are no other steps done in Power Query. That is just how the data comes in.
Could this be a bug? Some kind of parsing on the way?
Thanks for the help!
Kind regards
Manuel
Thanks for the reply.
Your first suggestion sadly won't work, because the fields we are dealing with a custom fields in SAP. New ones can be added and the are barely any restriction for neither label or value. In other words, at any point there can be double quotes in the strings. Therefore we have no reliable way to do the replace value without messing with the required double quotes of the JSON structure.
As for your second suggestion, how exactly would you go about validating and correcting the JSON string with a custom column and M?
Thanks and beste regards
Manuel
Hi @Manuel_Grutsch ,
After loading the data into Power BI, use the Power Query Editor to manually insert the missing escape characters. You can use the Replace Values feature to find all instances of 54"" and replace them with 54\"".
Or before attempting to parse the JSON in Power BI, use a custom column in Power Query to validate and possibly correct the JSON string. This can be done using the M language to ensure that the JSON string is correctly formatted for parsing.
Best Regards,
Stephen Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the June 2024 Power BI update to learn about new features.
User | Count |
---|---|
34 | |
19 | |
18 | |
16 | |
13 |