Hi, I have a problem deserializing base64 json back to a .net object using wcf datacontract ....
I have this for deserialization:
public static T FromJSON<T>( this string json )
{
using ( MemoryStream ms = new MemoryStream(ASCIIEncoding.Default.GetBytes(json)) )
{
DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(T));
return (T)ser.ReadObject(ms);
}
}
and ... I have it in my model class ...
[DataMember]
[Column(AutoSync = AutoSync.Always, DbType = "rowversion not null", CanBeNull = false, IsDbGenerated = true, IsVersion = true, UpdateCheck = UpdateCheck.Never)]
public byte[] timestamp { get; set; }
and ... I pass json back like that ...
[{"id":"1","type":"H","date_issued":"\/Date(1286856000000)\/","date_ceu":"\/Date(1603166400000)\/","current":true,"timestamp":"AAAAAAAAD7M="}]
and for some reason he just refuses to just translate that base64 back to byte [] ... there must be some other way to make it work ...
also, fyi I use ASP.NET MVC and Html.Hidden (...), which serializes the binary in base64 to start with ...
thank!
source
share