Hello all,
i great a Json from a table which is 1200 line, i save them as text file for testing when i copy them to Post man its working but when i do http request always error 500,
if i copy the Json from debug always end up like this
If i read from the same file as text its working can someone explain why!
my code
// Create a list to store JSON objects
List<object> jsonObjects = new List<object>();
// Loop through the DataTable rows
foreach (DataRow row in dataTable.Rows)
{
// Extract data from the current row
string fullName = row["Name"].ToString();
// Create JSON object for the current row
var jsonObject = new
{
gridPersonPartyInfo = new
{
gridPersonData = new
{
personName = new
{
fullName = fullName
}
},
partyContext = new
{
note = "No notes"
}
}
};
// Add the JSON object to the list
jsonObjects.Add(jsonObject);
}
// Wrap JSON objects in a container object
var gridInquiries = new { gridInquiries = jsonObjects };
// Convert to JSON
json = JsonConvert.SerializeObject(gridInquiries, Newtonsoft.Json.Formatting.Indented);
// Print the JSON to console
Console.WriteLine(json);