Exporting CSV (or markdown) exports jsonb as `[object Object]`
See original GitHub issueBug report
Describe the bug
Exporting rows from a table with jsonb columns, exports those as a JavaScript [object Object]
To Reproduce
- Go to https://app.supabase.com/project/<your project id>/sql (The “Sql query” tab in your project dashboard).
- Click on “New Query” and enter
select * from auth.users; - Run the query
- Notice how the
raw_app_metadatashows up as a nice json string in the table (expected behavior) - Click on the “Results” dropdown and click “Download CSV”.
- Inspect the csv and notice how
raw_app_metadatashows[Object object]instead of the actual metadata (not expected)
Expected behavior
The exported csv would show the same json string that the ui does
System information
- Browser: Firefox
Additional context
Also a problem with the markdown exporter
Previously reported here https://github.com/supabase/supabase/issues/1764
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Exporting CSV exports jsonb as [object Object] #1764 - GitHub
Select rows from a table with jsonb · Click Export CSV ...
Read more >Export JSON to CSV file using Javascript (in the browser)
Call the“exportCSVFile(headers, itemsFormatted, fileTitle)” function and insert your own “headers”, “itemsFormatted” and “fileTitle” variables.
Read more >Small JavaScript Library To Export JSON Data To CSV File
CSV -Export is a small and easy-to-use JavaScript library which lets you export JSON data to a CSV file.
Read more >Object to CSV format and Export in JavaScript - Stack Overflow
The problem is not in the part you have shown us, but in the actual downloadCSV function that is only contained in your...
Read more >Serialize and Deserialize objects to JSON (or whatever) format |
Serialize.Template class, it'll be relatively easy to adapt it to have a pre-compiled export/import methods to export/import data in whatever ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

[ For those who want CSV immediately ]
The following method solved the problem.
Example:
Please let me know if there is a smarter way to write this.
I would wait for a fundamental solution. But if you want CSV immediately, try this method.
In my case, I had the same problem with the JSON type. Sorry if this is not helpful since it is not jsonb.
Before :
After :
@Gautam-Arora24
You are welcome to submit a PR. I don’t have any repo powers; I’m just a contributor.