To turn JSON into a table in Power BI, use Power Query: get the JSON as a data source, expand the record or list columns, and then load the result. The exact steps depend on whether your JSON is a file, a web API response, or pasted text, but the core pattern is the same: import, navigate to the data, expand, and shape. This guide walks through the reliable path for each common source, plus how to handle nested structures and arrays that do not expand cleanly on the first try.
What You'll Need
- Power BI Desktop (the free version is fine; the steps below refer to the desktop app, since Power BI Service has a more limited data-shaping experience).
- A JSON file, a URL that returns JSON, or a block of JSON text you can save as a file.
- Basic familiarity with Power Query Editor, which opens automatically when you connect to most data sources.
Step-by-Step
- Open Power Query Editor. In Power BI Desktop, go to Home > Transform data. This opens the Power Query Editor window where all shaping happens. Menu labels can differ slightly by version and region, but the Transform data button is consistently on the Home ribbon.
- Connect to your JSON source. On the Home ribbon, choose New Source. For a local file, pick File > JSON and browse to the file. For a web API, pick Web and paste the URL (you may need to supply headers or an API key under Advanced). For pasted text, save it as a .json file first and use the File route; Power Query does not have a paste-JSON button.
- Inspect the initial result. Power Query usually detects JSON and offers to convert it. If you see a single cell containing a Record or List value, click the word Record or List in that cell to drill into the structure. This is the navigation step that reveals what the JSON actually contains.
- Convert to a table if needed. If the data arrives as a list of records, use Transform > To Table (or right-click the column header and choose To Table) to turn the list into rows. Accept the default delimiter and click OK. You now have a table with one column holding record values.
- Expand the record column. Click the expand icon (two arrows pointing outward) in the column header. A checklist of fields appears. Clear the box for using the original column name as a prefix if you want clean headers, then select the fields you need and click OK. Each selected field becomes its own column.
- Handle nested records one level at a time. If a field you expanded is itself a Record, it will appear as a column of Record values. Expand that column the same way. Repeat until all the data you need is in flat columns. Expanding too many levels at once is the most common source of confusing column names, so work one level at a time and rename as you go.
- Expand lists inside records. A field that contains a list (for example, multiple tags or line items) will show as a List value. Click the expand icon and choose Expand to New Rows if you want one row per list item, or Extract Values if you want the items joined into a single text field. Expand to New Rows duplicates the parent row for each list item, which is usually what you want for line-item data but will change your row count.
- Set data types. Select each column and set the type from the Transform tab: Whole Number, Decimal Number, Date, Text, and so on. Power Query often guesses types, and wrong guesses (especially dates read as text) cause errors later in the model. Do this before loading.
- Remove unused columns and rename. Right-click column headers to remove what you do not need, and double-click headers to rename them to friendly names. Keeping the model narrow improves refresh speed and report clarity.
- Load to the model. Choose Home > Close & Apply. Power Query applies the steps and loads the table into the data model, where you can build visuals. If you want to check the result first, use Close & Apply and then open the Data view to confirm row counts and types.
Common Mistakes
- Expanding everything at once. Selecting every field in the expand dialog creates dozens of columns, many of them nested Records or Lists that still need work. Expand only what you need, one level at a time.
- Ignoring the row-count change from Expand to New Rows. This step multiplies rows by the number of list items. If your totals later look inflated, check whether a list expansion duplicated parent rows.
- Leaving dates and numbers as text. Text-typed numbers sort alphabetically and break date hierarchies. Set types explicitly in Power Query rather than relying on AutoDetect.
- Hard-coding a file path. If the file moves, refresh fails. Use a parameter for the path or store the file in a stable location such as a SharePoint folder you can connect to.
- Forgetting that JSON keys are case-sensitive in some sources. If a field you expect is missing after expansion, compare the exact key names in the source with what Power Query shows.
Tips
- Use the Applied Steps pane to review and reorder steps. You can click any step to see the data at that point, which makes debugging much faster than guessing.
- Rename steps as you go (right-click a step > Rename). Future you will thank you when a refresh breaks.
- If the JSON is large, filter rows early in the query rather than after loading. Filtering before expansion reduces the work Power Query does on nested structures.
- For APIs that paginate, check the response for a next-page link and use Power Query's web functions to loop through pages, or ask the API provider for a bulk export.
- Keep a sample of the raw JSON handy. When a refresh fails after the source changes, comparing the sample to the current structure shows which key was renamed or removed.
Troubleshooting
The expand icon is missing. The column probably contains text, not Record or List values. Check the column type icon in the header; if it shows ABC, the JSON was not parsed. Re-run the source connection and make sure you accepted the JSON conversion prompt, or use Transform > Parse > JSON on the column.
Only one row appears after loading. You likely loaded the top-level record instead of the list inside it. Go back to the navigation step, drill into the list, convert it to a table, then expand.
Refresh fails with a data source error. The file path, URL, or credentials may have changed. Open Data source settings from the Home ribbon, check the path and permissions, and re-enter credentials if prompted. If the API requires a key, confirm it is still valid.
Columns are full of Errors. Click the error cell to see the message. Common causes are a type mismatch (for example, an empty string in a number column) or a missing field after a source change. Replace errors with null or adjust the type.
Dates come in as numbers. Some APIs return dates as Unix timestamps. Convert them with a custom column using the appropriate date conversion function, or change the type to Date after dividing by the correct factor if the source uses seconds or milliseconds.
Frequently Asked Questions
Can I import JSON directly from a URL?
Yes. Use New Source > Web, paste the URL, and authenticate if required. Power Query will detect JSON and offer the same navigation and expansion steps as a local file.
What is the difference between Expand and Extract Values?
Expand to New Rows creates one row per item in a list, duplicating the parent row. Extract Values joins list items into a single delimited text value in the same row. Choose based on whether you need separate rows or a single combined field.
Why did my row count change after expanding?
Expanding a list with Expand to New Rows multiplies the parent row by the number of list items. This is expected for line-item data but will inflate totals if you did not intend it.
Can I combine multiple JSON files from a folder?
Yes. Use New Source > Folder, point to the folder, then combine the files. Power Query will apply the same transformation steps to each file, provided they share a structure.
Does this work in Power BI Service?
The Service has a more limited data-shaping interface. For full control over JSON expansion, shape the query in Power BI Desktop and publish the report; the Service will refresh using the published query.
How do I handle JSON that changes structure over time?
Build the query defensively: expand only the fields you need, set types explicitly, and keep a sample of the raw JSON. When the source changes, update the affected step rather than rebuilding the query.