Unable Deserialize JSON Array to C# object

I have a HTML page and some Javascript code that is making an AJAX call. On the server side in my API(C#) I am receiving a JSON Array as follows, which can have max 60 elements. For each element I have a class object mapped.

However I am unable to deserialize the array into some any C# object. I have tried Array[], ArrayList and even MyObject[], but nothing.

Can someone please help how I can deserialize each element to MyObject.

I am getting some "illegal character" message when I add breakpoint in Visual Studio and inspect.

{[
      {
        "PosX": 1458,
        "PosY": 198,
        "Rotation": 250,
        "Width": 63,
        "Height": 25,
        "URL": "http://localhost:7071/2.png",
        "Name": "10",
        "RawURL": "/Case16/10-2.png",
        "BelongsTo": "k",
        "AppliedRotation": 96,
        "ImageID": 49
      },
      {
        "PosX": 1418,
        "PosY": 563,
        "Rotation": 118,
        "Width": 28,
        "Height": 68,
        "URL": "http://localhost:707/11.png",
        "Name": "10",
        "RawURL": "/Case16/10-1.png",
        "BelongsTo": "karyotype",
        "AppliedRotation": 174,
        "ImageID": 48
      }
    ]}


Read more here: https://stackoverflow.com/questions/68464207/unable-deserialize-json-array-to-c-sharp-object

Content Attribution

This content was originally published by user1144596 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: