Q:

How to parse a JSON having multiple object in an array using mvc5?

I have a web API which return the JSON when called. The problem is it returns array of JSON having multiple object. I need to parse it for my class to create a grid.
You can check my api here.
I'm getting following error while parsing it

Blockquote
  "Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON array (e.g. [1,2,3]) into type 'OpsArc.Models.OnBoardingDetailsWithResourceDTO' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
  Path '', line 1, position 1.'"

A:

You can use this website (JSON2CSharp) to translate your json output into their respective classes. You'll get the following output
public class ThisResource
{
    public string id { get; set; }
    public object empRec { get; set; }
    public int createdBy { get; set; }
    public object payrollId { get; set; }
    public int resourceTypeID { get; set; }
    public string resourceTypeValue { get; set; }
    public string resourceTypeStoredValue { get; set; }
    public string ssn { get; set; }
    public string lastName { get; set; }
    public string middleName { get; set; }
    public string firstName { get; set; }
    public string localEmployeeId { get; set; }
    public int resourceStatusId { get; set; }
    public object resourceStatusValue { get; set; }
    public object resourceStatusStoredValue { get; set; }
    public object vendorId { get; set; }
    public object alertRec { get; set; }
    public object alertNote { get; set; }
    public object divRec { get; set; }
    public object repRec { get; set; }
    public object hold { get; set; }
    public object holdNote { get; set; }
    public object cdid { get; set; }
    public object shortNotes { get; set; }
    public object doNotPlace { get; set; }
    public object modifiedBy { get; set; }
    public object lastModifiedOn { get; set; }
    public DateTime ts { get; set; }
}

public class ThisBoardingDetails
{
    public string id { get; set; }
    public string resourceOnboardingID { get; set; }
    public int desiredResourceTypeID { get; set; }
    public int offerExpires { get; set; }
    public object desiredResourceTypeValue { get; set; }
    public object desiredResourceTypeStoredValue { get; set; }
    public string jobOrderID { get; set; }
    public string backgroundCheckID { get; set; }
    public int emailID { get; set; }
    public string requestDate { get; set; }
    public object onboardingRequest { get; set; }
    public int onboardingStatusCode { get; set; }
    public string resourceID { get; set; }
}

public class RootObject
{
    public ThisResource thisResource { get; set; }
    public ThisBoardingDetails thisBoardingDetails { get; set; }
}

You will need to fix a few things, but it's a good enough resource to give you a start.

