Question: how to convert data from database to json in c#?
Answer: public string DataTableToJSONWithStringBuilder(DataTable table)
{
var JSONString = new StringBuilder();
if (table. Rows. Count > 0)
{
JSONString. Append("[");
for (int i = 0; i < table. Rows. Count; i++)
{