-
June 18th, 2008, 04:29 PM
#1
.NET Ajax Json deserialization
Creating a WebHttpRequest (C#) and sending call to WCF Service.
Recieve back Json String but when I try to use the DataContractDeserializer method it does not like the leading bracket that the string I got back from the call has. Note that if I remove the leading bracket and 'd' char it works.
string jsonStr = JsonTest.callJsonMethod(url, "GetTaskInstance", parameters);
List<Type> typeList = new List<Type>();
typeList.Add(typeof(Task));
DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(TaskInstance), typeList, int.MaxValue, true, null, true);
MemoryStream memoryStream = new MemoryStream(Encoding.Unicode.GetBytes(jsonStr));
Can this be related to how I am configuring my request?
Uri uri = new Uri(buffer.ToString());
newRequest = (HttpWebRequest)WebRequest.Create(uri);
newRequest.Method = "GET";
newRequest.ContentType = "application/json";
newRequest.ContentLength = 0;
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|