
Hi All,
I have developed a custom service and one of the parameter in my custom service is of type ArrayList. I am using service sample provided by Microsoft to call my custom service and passing ArrayList object. The list comes as ArrayList and I am able to assign it to ArrayList object in my service class. Until here it works fine, but when I am trying to assign the element in the list (i.e. Array of string values) to System.String [] variable, I am getting following exception :
Unable to cast object of type 'Newtonsoft.Json.Linq.JArray' to type 'System.String[]'
To resolve this, I declared a variable of type JArray and used the following code snippet:
while (listEnumerator.MoveNext())
{
jsonArray = new Newtonsoft.Json.Linq.JArray();
jsonArray = listEnumerator.Current;
I am getting the values in jsonArray variable, but just unable to traverse through each value in Array. There are six elements in the array and I want to retrieve all the values to use it in a different process in my service class.
Any clue how to achieve this ?
Thanks,
Baber.
*This post is locked for comments
I have the same question (0)And here is the JSON request:
{ "_inventLocationIdFrom": "9339", "_inventLocationIdTo": "9175", "_listOfTransferOrderLine": [ [ "40416", "000873", "Joseph ", "9f640402-8e27-49d2-93a1-d84827e99401", "crm", "1" ] ], "_notes": "", "_shipDate": "2017-08-25" }
As you can see the fourth parameter is the list of Array.
Thanks,
Baber.