Created
May 5, 2021 01:13
-
-
Save abidanBrito/465571119f529c16b6a05a7a2b914d43 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringBuilder jsonData = new StringBuilder(); | |
jsonData.Append("["); | |
for (int i = 0; i < dt.Rows.Count; ++i) | |
{ | |
jsonData.Append("{"); | |
jsonData.Append("\"" + "DNI" + "\":" + "\"" + dt.Rows[i][0] + "\"" + "," + "\"" + "Name" + "\":" + "\"" + dt.Rows[i][1] + "\"" + ","); | |
jsonData.Append("\"" + "Telephone" + "\":" + "\"" + dt.Rows[i][2] + "\"" + "," + "\"" + "Observations" + "\":" + "\"" + dt.Rows[i][3] + "\""); | |
if (i == dt.Rows.Count - 1) { jsonData.Append("}"); } | |
else { jsonData.Append("},"); } | |
} | |
jsonData.Append("]"); | |
string jsonArray = jsonData.ToString(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment