how to export datas to json file from mysql

I have datas in mysql I want to move them to a json file. How can I do that?
No description
No description
7 Replies
kurumi
kurumi9mo ago
I think you don't even need a C# for this. Is there any MySQL extension that helps writing data into a file? or you can do it manually by using Dapper / EF Core and stringify as JSON into a file
kurumi
kurumi9mo ago
Stack Overflow
How to convert result table to JSON array in MySQL
I'd like to convert result table to JSON array in MySQL using preferably only plain MySQL commands. For example with query SELECT name, phone FROM person; | name | phone | | Jack | 12345 | | John |
only you know
only you knowOP9mo ago
I need to write as a service so I can do it from controller that's my task
kurumi
kurumi9mo ago
I see so as I told, use Dapper or EF Core to get list of your items and then stringify it as json
only you know
only you knowOP9mo ago
can't use both. only ado and linq allowed
Pobiega
Pobiega9mo ago
You should be able to do this by now. Just break it down. Query data from database, save in memory as objects serialize objects to json write to file
only you know
only you knowOP9mo ago
yh I managed to do it. I used DTO and serialized it
Want results from more Discord servers?
Add your server