JSON Deserialization nightmare

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Nightcrawler

    #1

    JSON Deserialization nightmare

    I am trying to deserialize a simple string using the following method:

    private object JSONDeserialize (string Deserialization Target, Type
    TargetType)
    {
    MemoryStream ms = new
    MemoryStream(En coding.Unicode. GetBytes(Deseri alizationTarget ));
    DataContractJso nSerializer serializer = new
    DataContractJso nSerializer(Tar getType);

    object Product = serializer.Read Object(ms);
    ms.Close();

    return Product;
    }

    The string value for Deserialization Target 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:


    Any help is appreciated.

    Thanks
Working...