Forum Discussion
Power BI Desktop Theme Import Error: JSON Syntax Invalid or Invalid Top-Level Property
- 9 months ago
Hi ShoyaY,
It took me time to understand your issue....So this issue caused due to several factors:
- Power BI has strict requirements for JSON theme file structure
- Some custom fonts may not be available in Power BI
- dataLabels and legend may need to be placed under specific visual types rather than the generic "*" section
So try this approaches and tell me if it works:
First Approach :
- Try this modified JSON structure that avoids using potentially unsupported properties in generic sections:
{
"name": "Noto Sans JP Fixed Theme",
"textClasses": {
"callout": { "fontFace": "Noto Sans JP" },
"title": { "fontFace": "Noto Sans JP" },
"header": { "fontFace": "Noto Sans JP" },
"label": { "fontFace": "Noto Sans JP" }
},
"visualStyles": {
"*": {
"*": {
"*": [{
"fontFamily": "Noto Sans JP",
"fontSize": 10
}],
"title": [{
"fontFamily": "Noto Sans JP",
"fontSize": 12
}],
"labels": [{
"fontFamily": "Noto Sans JP",
"show": true
}]
}
},
"columnChart": {
"*": {
"dataLabels": [{
"fontFamily": "Noto Sans JP"
}],
"legend": [{
"fontFamily": "Noto Sans JP"
}]
}
},
"barChart": {
"*": {
"dataLabels": [{
"fontFamily": "Noto Sans JP"
}],
"legend": [{
"fontFamily": "Noto Sans JP"
}]
}
},
"lineChart": {
"*": {
"dataLabels": [{
"fontFamily": "Noto Sans JP"
}],
"legend": [{
"fontFamily": "Noto Sans JP"
}]
}
}
}
}
Second Approach :
- If the above does not work try adding single quotes around the font name:
"textClasses": {
"callout": { "fontFace": "'Noto Sans JP'" },
"title": { "fontFace": "'Noto Sans JP'" },
"header": { "fontFace": "'Noto Sans JP'" },
"label": { "fontFace": "'Noto Sans JP'" }
}
Bonus Approach :
First apply a base theme without dataLabels and legend
Use Format Painter to standardize formats
Manually set fonts for elements that can not be controlled via theme
Notes :
- Some custom fonts may not be available in all contexts within Power BI (this is a known limitation)
Consider downgrading to an older Power BI version (like December 2022 release) as a temporary workaround
- Power BI themes do not override manually set formats
Hi Ahmed-Elfeel
Thank you so much for your excellent suggestions and for helping me understand the issue!
I’m very happy to report that the JSON structure you provided (which places dataLabels and legend under specific visual types) successfully imported into Power BI Desktop! This is a significant breakthrough in applying my custom font.
Here’s what is now working correctly with the imported theme:
- Text boxes: Font is ‘Noto Sans JP’.
- Table visuals: Font is ‘Noto Sans JP’.
- Bar chart (e.g., column chart): Y-axis values/labels (axis text) are ‘Noto Sans JP’.
- Pie chart: Legend font is ‘Noto Sans JP’.
However, I am still facing challenges with specific elements, and I’d appreciate your further guidance:
- Pie Chart Data Labels: The numerical values, percentages, and category names displayed as data labels on the pie chart are still NOT changing to ‘Noto Sans JP’. I’ve tried including dataLabels properties for pieChart in the theme, but the font doesn’t apply to these specific text elements.
- Bar Chart Data Labels: Similarly, the numerical values displayed as data labels on the bar chart (on top of the bars) are also NOT changing to ‘Noto Sans JP’.
My goal is to have the ‘Noto Sans JP’ font applied to all text elements within my reports, including these data labels on pie and bar charts.
Could you please advise on how I might modify the JSON further to ensure the ‘Noto Sans JP’ font is applied to the data labels (numerical values, percentages, and category names) of pie charts and bar charts? Are there specific properties or additional settings required for these particular elements within the theme JSON?
Thank you again for your invaluable help!
- Ahmed-Elfeel9 months agoSuper User
Hi ShoyaY,
Happy to hear this ☺️❤️
So the issue with pie chart and bar chart data labels you are facing is a common one, they often require more specific targeting in the JSON....So could you try this JSON structure that specifically targets data labels for pie charts and bar charts :
{ "name": "Noto Sans JP Complete Theme", "textClasses": { "callout": { "fontFace": "Noto Sans JP" }, "title": { "fontFace": "Noto Sans JP" }, "header": { "fontFace": "Noto Sans JP" }, "label": { "fontFace": "Noto Sans JP" } }, "visualStyles": { "*": { "*": { "*": [{ "fontFamily": "Noto Sans JP", "fontSize": 10 }], "title": [{ "fontFamily": "Noto Sans JP", "fontSize": 12 }], "labels": [{ "fontFamily": "Noto Sans JP", "show": true }] } }, "columnChart": { "*": { "dataLabels": [{ "fontFamily": "Noto Sans JP", "color": "#000000", "show": true }], "legend": [{ "fontFamily": "Noto Sans JP" }] } }, "barChart": { "*": { "dataLabels": [{ "fontFamily": "Noto Sans JP", "color": "#000000", "show": true }], "legend": [{ "fontFamily": "Noto Sans JP" }] } }, "pieChart": { "*": { "dataLabels": [{ "fontFamily": "Noto Sans JP", "color": "#000000", "show": true, "categoryLabel": { "fontFamily": "Noto Sans JP", "show": true }, "value": { "fontFamily": "Noto Sans JP", "show": true }, "percentage": { "fontFamily": "Noto Sans JP", "show": true } }], "legend": [{ "fontFamily": "Noto Sans JP" }] } }, "donutChart": { "*": { "dataLabels": [{ "fontFamily": "Noto Sans JP", "color": "#000000", "show": true, "categoryLabel": { "fontFamily": "Noto Sans JP", "show": true }, "value": { "fontFamily": "Noto Sans JP", "show": true }, "percentage": { "fontFamily": "Noto Sans JP", "show": true } }] } } } }If the above JSON still does not work for data labels, try these additional approaches:
- Reset Visual Formatting First
Select your pie/bar chart
Go to Format pane → Data labels
- Click Reset to default (if available)
Then reapply your theme
If the theme still doesn't catch data labels, you can:
Apply the theme first
Then manually set data label fonts in the Format pane
Use Format Painter to copy these settings to other similar visuals
Try this more explicit structure for pie charts:
"pieChart": { "*": { "dataLabels": [{ "fontFamily": "Noto Sans JP", "show": true, "labelStyle": { "fontFamily": "Noto Sans JP" } }] } }Important Notes you should Know it:
- Some data label properties might not be fully theme able due to Power BI limitations
- If you previously manually formatted data labels the theme won't override them until you reset to default
- Some visual types (especially custom visuals) may not respect all theme settings
Let me know how this works!😀❤️
if this post helps, then I would appreciate a thumbs up and mark it as the solution to help the other members find it more quickly.- ShoyaY9 months agoNew Member
Hi Ahmed-Elfeel ,
I wanted to provide an update and express my sincere gratitude for your invaluable help!
All the issues are now resolved, and my custom font (‘Noto Sans JP’) is successfully applied to all text elements in my Power BI reports, including data labels and legends!
The key to the final solution was combining your modified JSON structure (which places dataLabels and legend under specific visual types) with an additional step:
- I imported the theme JSON file you provided (or a slightly extended version of it, including pieChart settings). This part worked perfectly, and the theme imported without any errors.
- For any text elements that did not immediately update to ‘Noto Sans JP’ after importing the theme (e.g., data labels on pie/bar charts), I found that using the “Reset to default” option in the visual formatting pane for that specific element caused the ‘Noto Sans JP’ font to be applied correctly.
This confirms that the theme was indeed loaded with the correct font settings, but some existing visual elements needed to be explicitly reset to adhere to the new theme.
Now, all my text boxes, table visuals, bar chart axis values, pie chart legends, and most importantly, data labels on bar charts and pie charts are correctly displaying ‘Noto Sans JP’.
Thank you again so much for your persistent support and excellent guidance. Your insights on placing dataLabels and legend under specific visual types were crucial, and the combined approach (import + reset to default) has finally led to a complete solution!
I would be happy to mark your initial helpful post as the solution.
- Ahmed-Elfeel9 months agoSuper User
- Reset Visual Formatting First