I am trying to deserialize a simple string using the following method:
private object JSONDeserialize(string DeserializationTarget, Type
TargetType)
{
MemoryStream ms = new
MemoryStream(Encoding.Unicode.GetBytes(Deserializa tionTarget));
DataContractJsonSerializer serializer = new
DataContractJsonSerializer(TargetType);
object Product = serializer.ReadObject(ms);
ms.Close();
return Product;
}
The string value for DeserializationTarget is "test" and the
TargetType is:
{Name = "String" FullName = "System.String"} of the ParameterInfo
object.
The error I keep getting is: There was an error deserializing the
object of type System.String. The token 'true' was expected but found
'test'. I can barely find any information on this.
The full code to this can be located here:
http://www.codeproject.com/KB/webser...ion&view=Quick
Any help is appreciated.
Thanks