Json limitation

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
image
with the three dots

is request body always with double “”
image
is that correct!

BR/Hazem

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);

Input dataTable out json as String

A textfile containing a JSON will look like this:
{"A":"Value", "ID", 123}

the same string in one of the debugging panels:
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

can have different visualizations of the inner " like "" \"
But it is a visualization and not the the content

A serialized JSON string could look like
"{\"A\":\"Value\",\n \"ID\", 123}"

then \" \n are part of string, but it is the serialized JSON and should not be mismatched with a plain JSON string

1 Like

Thanks again :slight_smile:

i just forgot to switch the body format to application/json now its working :slight_smile:

Perfect so the topic can be closed
Forum FAQ - How to mark a post as a solution - News / Tutorials - UiPath Community Forum

2 Likes

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.