0

how to Deserialize JSON to List<SOROCat> in C#, please help me. Not able to get where I am going wrong. Any help would be really appreciated.

The JSON is as follows.

"[
  {
    "RequestOffering": "DC - Virtual Server Installation",
    "ServiceOffering": "DC - VPS",
    "CategoryGUID": "Enum.176787fee69b4feabae2ac0a02d1d7dc",
    "CategoryDisplayName": "Data Center",
    "TemplateName": "Template.a98f4f80e2a44454854fe314a3a98aab",
    "TemplateObject": {
      "TypeID": {
        "Name": null,
        "Id": "9dcf1f69-e495-af57-a30e-741af1836bd2",
        "Identifier": {
          "Value": "1|PishroSystem.ServiceRequest.Form/7a1fbae719247839|1.0.0.0|Afranet.ServiceRequest.Form_TypeProjection||"
        }
      },
      "TypeConstraint": null,
      "PropertyCollection": [],
      "ObjectCollection": [
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "0"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4171"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "انجام امور مالی قراردادی"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ احتراماً خواهشمند است پیرو امکان سنجی صورت گرفته و تایید آن توسط واحد فنی و با توجه به هماهنگی با نماینده مشتری اقدامات لازم در خصوص راه اندازی سرویس صورت گیرد. (اطلاعات مورد نیاز در بخش مربوطه در CRM موجود می‌باشد.)"
            }
          ],
          "ObjectCollection": []
        },
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "5"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4179"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Stage$",
              "MixedValue": "4b667400-5448-3dd0-a4ee-2170a985375b"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "به روز رسانی سرورهای اتوماسیون"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ لطفاً سرورهای اتوماسیون را به روز رسانی کنید."
            }
          ],
          "ObjectCollection": []
        },
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "1"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4173"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Stage$",
              "MixedValue": "4b667400-5448-3dd0-a4ee-2170a985375b"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "تخصیص سرور جهت راه اندازی سرویس - تیم VIRTUALIZATION"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ لطفاً تنظیمات فنی لازم جهت تخصیص سرویس vps به مشتری صورت گیرد."
            }
          ],
          "ObjectCollection": []
        },
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "2"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4175"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Stage$",
              "MixedValue": "4b667400-5448-3dd0-a4ee-2170a985375b"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "انجام اقدامات تیم فنی جهت راه اندازی -  تیم VIRTUALIZATION"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ لطفاً اقدامات فنی لازم جهت تخصیص سرویس vps به مشتری صورت گیرد."
            }
          ],
          "ObjectCollection": []
        },
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "4"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4177"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Stage$",
              "MixedValue": "4b667400-5448-3dd0-a4ee-2170a985375b"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "اطلاع رسانی دسترسی سرور به مشتری - تیم VIRTUALIZATION"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ لطفاً اطلاعات مربوط به دسترسی سرور به مشتری اطلاع راسنی شود."
            }
          ],
          "ObjectCollection": []
        },
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "3"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4185"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Stage$",
              "MixedValue": "4b667400-5448-3dd0-a4ee-2170a985375b"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "فعال سازی FTP - فنی DC "
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ لطفاً با توجه به درخواست مشتری اقدامات لازم جهت فعال سازی FTP صورت گیرد."
            }
          ],
          "ObjectCollection": []
        },
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "6"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "4189"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Stage$",
              "MixedValue": "ddab38d4-30a9-3a4c-30dc-d207b954634a"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "به روزرسانی Ripe و Matma  - تیمCore"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام؛ لطفاً اقدامات فنی لازم جهت به‌روزرسانی IP مشتری در Ripe و Matma صورت گیرد."
            }
          ],
          "ObjectCollection": [
            {
              "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Library!System.WorkItemAssignedToUser' TypeConstraint='CustomMicrosoft_Windows_Library!Microsoft.AD.Group']$",
              "PropertyCollection": [
                {
                  "Path": "$Context/Property[Type='CustomMicrosoft_Windows_Library!Microsoft.AD.UserBase']/DistinguishedName$",
                  "MixedValue": "CN=Core Team,OU=Users,OU=Members,OU=Core,OU=Afranet,DC=afranet,DC=local"
                },
                {
                  "Path": "$Context/Property[Type='CustomMicrosoft_Windows_Library!Microsoft.AD.UserBase']/ObjectGuid$",
                  "MixedValue": "86e05aeb-8ad5-4422-ae84-fa996d1015f0"
                },
                {
                  "Path": "$Context/Property[Type='CustomMicrosoft_Windows_Library!Microsoft.AD.UserBase']/SID$",
                  "MixedValue": "S-1-5-21-931204019-4140322259-2122501801-5360"
                },
                {
                  "Path": "$Context/Property[Type='CustomMicrosoft_Windows_Library!Microsoft.AD.UserBase']/FQDN$",
                  "MixedValue": "afranet.local"
                },
                {
                  "Path": "$Context/Property[Type='CustomMicrosoft_Windows_Library!Microsoft.AD.UserBase']/UPN$",
                  "MixedValue": "Core [email protected]"
                },
                {
                  "Path": "$Context/Property[Type='CustomMicrosoft_Windows_Library!Microsoft.AD.UserBase']/OrganizationalUnit$",
                  "MixedValue": "Users,Members,Core,Afranet"
                },
                {
                  "Path": "$Context/Property[Type='CustomSystem_Library!System.Domain.User']/Domain$",
                  "MixedValue": "AFRANET"
                },
                {
                  "Path": "$Context/Property[Type='CustomSystem_Library!System.Domain.User']/UserName$",
                  "MixedValue": "Core Team"
                },
                {
                  "Path": "$Context/Property[Type='CustomSystem_Library!System.ConfigItem']/ObjectStatus$",
                  "MixedValue": "$MPElement[Name='CustomSystem_Library!System.ConfigItem.ObjectStatusEnum.Active']$"
                },
                {
                  "Path": "$Context/Property[Type='CustomSystem_Library!System.Entity']/DisplayName$",
                  "MixedValue": "AFRANET\\Core Team"
                }
              ],
              "ObjectCollection": []
            }
          ]
        }
      ],
      "XmlTag": "ObjectTemplate",
      "ManagementGroup": {
        "ConnectorFramework": {},
        "EntityTypes": {},
        "EntityObjects": {},
        "Knowledge": {},
        "LanguagePacks": {},
        "ManagementPacks": {},
        "Monitoring": {},
        "Overrides": {},
        "Presentation": {},
        "Dashboard": {},
        "Reporting": {},
        "Resources": {},
        "Security": {},
        "Subscription": {},
        "TaskConfiguration": {},
        "TaskRuntime": {},
        "Templates": {},
        "TypeCache": {},
        "TypeDefinitions": {},
        "DataWarehouse": {},
        "Notifications": {},
        "ServiceLevelAgreements": {},
        "Deployment": {},
        "TaskConfigurationInternal": {},
        "LinkingFramework": {},
        "UserSettings": {},
        "Name": "AfraSCSM",
        "Id": "42ff68ac-1bec-89bc-df9e-63efaddc5e8c",
        "IsConnected": true,
        "CacheMode": 1,
        "AutoRefreshCache": true,
        "ProductId": "03535-092-6002024-02739",
        "ConnectionSettings": {
          "ServerName": "172.17.2.11",
          "TieredManagementGroupConnectionSettings": null,
          "InactivityTimeout": 60,
          "SendReceiveTimeout": 30,
          "UserName": "csm",
          "Password": {
            "Length": 11
          },
          "Domain": "afranet",
          "CacheMode": 1,
          "CacheConfiguration": 0,
          "ThreeLetterWindowsLanguageName": "ENU"
        },
        "Version": {
          "Major": 7,
          "Minor": 5,
          "Build": 3079,
          "Revision": 0,
          "MajorRevision": 0,
          "MinorRevision": 0
        },
        "CurrentCountryCode": "ENU",
        "OriginalCountryCode": "ENU",
        "Registry": {},
        "Extensions": {},
        "LifetimeManagers": {
          "RegisteredTypes": [
            "External",
            "Singleton",
            "PerformanceTracing"
          ]
        },
        "Features": {}
      },
      "ManagementGroupId": "42ff68ac-1bec-89bc-df9e-63efaddc5e8c",
      "Identifier": {
        "Value": "1|ManagementPack.3860a76b540a44e2be6aa8c94b23e544|1.0.0.0|Template.a98f4f80e2a44454854fe314a3a98aab||"
      },
      "Name": "Template.a98f4f80e2a44454854fe314a3a98aab",
      "Id": "135696e7-8017-39b6-0588-4e1e255ad930",
      "DisplayName": "DC - Virtual Server Installation",
      "Description": null,
      "LanguageCode": "ENU",
      "Comment": null,
      "Status": 0,
      "LastModified": "2016-11-23T09:54:03.04",
      "TimeAdded": "2016-11-07T12:48:28.807",
      "InstanceName": null
    }
  },
  {
    "RequestOffering": "Access to Monitoring",
    "ServiceOffering": "DC - VPS",
    "CategoryGUID": "Enum.176787fee69b4feabae2ac0a02d1d7dc",
    "CategoryDisplayName": "Data Center",
    "TemplateName": "Template.39732e9d603942bc815e64e79d39d124",
    "TemplateObject": {
      "TypeID": {
        "Name": null,
        "Id": "9dcf1f69-e495-af57-a30e-741af1836bd2",
        "Identifier": {
          "Value": "1|PishroSystem.ServiceRequest.Form/7a1fbae719247839|1.0.0.0|Afranet.ServiceRequest.Form_TypeProjection||"
        }
      },
      "TypeConstraint": null,
      "PropertyCollection": [],
      "ObjectCollection": [
        {
          "Path": "$Context/Path[Relationship='CustomSystem_WorkItem_Activity_Library!System.WorkItemContainsActivity' TypeConstraint='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity.ManualActivity']$",
          "PropertyCollection": [
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/SequenceId$",
              "MixedValue": "0"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/ChildId$",
              "MixedValue": "5835"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Activity_Library!System.WorkItem.Activity']/Skip$",
              "MixedValue": "False"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Title$",
              "MixedValue": "Access to monitoring"
            },
            {
              "Path": "$Context/Property[Type='CustomSystem_WorkItem_Library!System.WorkItem']/Description$",
              "MixedValue": "باسلام; لطفا دسترسی مانیتورینگ را فعال کنید"
            }
          ],
          "ObjectCollection": []
        }
      ],
      "XmlTag": "ObjectTemplate",
      "ManagementGroup": {
        "ConnectorFramework": {},
        "EntityTypes": {},
        "EntityObjects": {},
        "Knowledge": {},
        "LanguagePacks": {},
        "ManagementPacks": {},
        "Monitoring": {},
        "Overrides": {},
        "Presentation": {},
        "Dashboard": {},
        "Reporting": {},
        "Resources": {},
        "Security": {},
        "Subscription": {},
        "TaskConfiguration": {},
        "TaskRuntime": {},
        "Templates": {},
        "TypeCache": {},
        "TypeDefinitions": {},
        "DataWarehouse": {},
        "Notifications": {},
        "ServiceLevelAgreements": {},
        "Deployment": {},
        "TaskConfigurationInternal": {},
        "LinkingFramework": {},
        "UserSettings": {},
        "Name": "AfraSCSM",
        "Id": "42ff68ac-1bec-89bc-df9e-63efaddc5e8c",
        "IsConnected": true,
        "CacheMode": 1,
        "AutoRefreshCache": true,
        "ProductId": "03535-092-6002024-02739",
        "ConnectionSettings": {
          "ServerName": "172.17.2.11",
          "TieredManagementGroupConnectionSettings": null,
          "InactivityTimeout": 60,
          "SendReceiveTimeout": 30,
          "UserName": "csm",
          "Password": {
            "Length": 11
          },
          "Domain": "afranet",
          "CacheMode": 1,
          "CacheConfiguration": 0,
          "ThreeLetterWindowsLanguageName": "ENU"
        },
        "Version": {
          "Major": 7,
          "Minor": 5,
          "Build": 3079,
          "Revision": 0,
          "MajorRevision": 0,
          "MinorRevision": 0
        },
        "CurrentCountryCode": "ENU",
        "OriginalCountryCode": "ENU",
        "Registry": {},
        "Extensions": {},
        "LifetimeManagers": {
          "RegisteredTypes": [
            "External",
            "Singleton",
            "PerformanceTracing"
          ]
        },
        "Features": {}
      },
      "ManagementGroupId": "42ff68ac-1bec-89bc-df9e-63efaddc5e8c",
      "Identifier": {
        "Value": "1|ManagementPack.3860a76b540a44e2be6aa8c94b23e544|1.0.0.0|Template.39732e9d603942bc815e64e79d39d124||"
      },
      "Name": "Template.39732e9d603942bc815e64e79d39d124",
      "Id": "e00a8acf-f263-104c-b6c8-cfb433f06ad1",
      "DisplayName": "Access to Monitoring",
      "Description": null,
      "LanguageCode": "ENU",
      "Comment": null,
      "Status": 0,
      "LastModified": "2016-11-23T12:11:57.723",
      "TimeAdded": "2016-11-23T08:59:29.94",
      "InstanceName": null
    }
  }
]"

my class is :

public class SOROCat
    {
        public String RequestOffering { get; set; }
        public String ServiceOffering { get; set; }
        public String CategoryGUID { get; set; }
        public String CategoryDisplayName { get; set; }
        public String TemplateName { get; set; }
        public ManagementPackObjectTemplate TemplateObject { get; set; }
    }

this is my code :

var response4 = await client.GetAsync("api/GetServiceRequestServiceRequestOffering");
response4.EnsureSuccessStatusCode();
string data = await response4.Content.ReadAsStringAsync();
List<SOROCat> genericEnum = JsonConvert.DeserializeObject<List<SOROCat>>(data);

Error message: Could not cast or convert from System.String to System.Collections.Generic.List`1[SCSMModel.SOROCat]

12
  • What is not working? Do you get an exception/error...? Commented Dec 13, 2016 at 8:04
  • Hi stephan-bauer ,the error is : Could not cast or convert from System.String to System.Collections.Generic.List`1[SCSMModel.SOROCat]. Commented Dec 13, 2016 at 8:08
  • try to deserialize small json object, after that apply same rules to your big document Commented Dec 13, 2016 at 8:12
  • 2
    Have you tried using something like - json2csharp.com - to visualise what it's expecting to retrieve. By the looks of things, I don't know what's in your ManagementPackObjectTemplate. But that appears to be more complex than your SOROCat object is presenting. Commented Dec 13, 2016 at 8:20
  • 2
    You've posted nearly 500 lines of JSON, and then snippets of code. Please reduce this to a minimal reproducible example. (Note that the client part is irrelevant - you should be able to reproduce this by either hard-coding the JSON or loading it from a file.) Commented Dec 13, 2016 at 8:41

3 Answers 3

0

The below uses JavaScriptSerializer class to deserialize the string to the expected format given, could you please try this solution

string data = await response4.Content.ReadAsStringAsync();
JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
return jsSerializer.Deserialize<T>(data);

In the place of you have to specify your expected type.

Sign up to request clarification or add additional context in comments.

Comments

0

i have to comment ManagementPackObjectTemplate and i have no idea for ManagementPackObjectTemplate

this is my class:

public class SOROCat
    {
        public String RequestOffering { get; set; }
        public String ServiceOffering { get; set; }
        public String CategoryGUID { get; set; }
        public String CategoryDisplayName { get; set; }
        public String TemplateName { get; set; }
        //public ManagementPackObjectTemplate TemplateObject { get; set; }
    }

after that I have some errors for converting the string \r\n so I use this link: link

var jsonStr = JsonConvert.DeserializeObject<string>(data);
                var genericEnum = JsonConvert.DeserializeObject<List<SOROCat>>(jsonStr, new JsonSerializerSettings
                {
                    TypeNameHandling = TypeNameHandling.Auto,
                    Formatting = Formatting.Indented
                });

Comments

-1

Use the generic version of DeserializeObject

SOROCat soroObj= JsonConvert.DeserializeObject<SOROCat>(json);

foreach (string str in soroObj.type[0])
{
    // TODO with str
}

For reference, you can use this link

1 Comment

The JSON isn't a single object - it's clearly an array, given that it starts with [ and ends with ]. The OP is already using the generic form of DeserializeObject.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.