How to Convert a Power Query Table Column to a JSON String
Question details
The user needs a method to convert a nested Table value within a Power Query column into a standard JSON-formatted text string.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- The user has aggregated or grouped data in a nested Power Query table and needs to export or pass this structured data to another system that requires JSON format.
- Observed behavior
- The data is currently held as a nested table object inside a Power Query column, which cannot be directly read or exported as raw JSON text without transformation.
Before attempting the conversion, verify that your nested table has clearly defined column names and appropriate data types to ensure the resulting JSON string is formatted correctly.
Use a Custom Column with M Functions
This method utilizes Power Query's built-in M functions to first encode the table into binary JSON data, and then decode that binary into a readable text string.
By combining Json.FromValue and Text.FromBinary, you can easily parse any nested structured value (like tables, records, or lists) into a serialized JSON string.
Ensure you have the exact name of the column containing your nested tables before adding the custom formula.
In Excel, go to the Data tab, click on 'Get Data' or 'Queries & Connections', and double-click your query to open the Power Query Editor.
Navigate to the 'Add Column' tab on the top ribbon and click the 'Custom Column' button.
In the Custom Column dialog box, enter the formula: =Text.FromBinary(Json.FromValue([PQ_Final output])). Be sure to replace '[PQ_Final output]' with the actual name of your nested table column.
Click 'OK' to create the column. The nested tables will now appear as readable JSON text strings. Finally, click 'Close & Load' to return your transformed data to the worksheet.

Looking for a Lightweight and Fast Spreadsheet Alternative?
While Power Query in Microsoft Excel is an advanced tool, it can sometimes be resource-heavy. If you are looking for a fast, intuitive, and feature-rich spreadsheet application for your daily data processing, WPS Office is an excellent free alternative.
- 1. Download WPS Office: Visit the official WPS Office website and download the free installation package for your operating system.
- 2. Install and Launch: Run the installer to set up WPS Office, then open WPS Spreadsheet to access your workspace.
- 3. Open Your Spreadsheets: Directly open your existing .xlsx files in WPS Spreadsheet to enjoy seamless data compatibility and fast performance.

Frequently Asked Questions
Can I convert multiple columns into a single JSON string?
Yes. Before using the JSON conversion formula, you should first merge or group the desired columns into a single nested Record or Table column. Then apply the Json.FromValue function to that newly created nested column.
Why am I getting an error when using Json.FromValue?
Errors usually occur if the nested table contains unsupported data types (like complex objects or unhandled errors). Ensure that all columns inside the nested table are formatted as standard text, numbers, or booleans.
How do I reverse a JSON string back into a nested table?
To parse a JSON string back into a Power Query table or record, you can add a Custom Column and use the function =Json.Document([YourJSONColumn]). You can then click the expand icon on the column header to extract the structured data.
Is there a limit to the length of the JSON string generated in Excel?
While Power Query can handle exceptionally large strings, standard Excel cells have a display limit of 32,767 characters. If your JSON string exceeds this limit, it will still exist in the data model but will appear truncated when loaded into an Excel worksheet.




