hey, I am having a problem deserializing base64 json back into the .net object using wcf datacontract....
I have this to deserialize:
public static T FromJSON( 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 this 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'm passing the json back like so...
[{"id":"1","type":"H","date_issued":"\/Date(1286856000000)\/","date_ceu":"\/Date(1603166400000)\/","current":true,"timestamp":"AAAAAAAAD7M="}]
and for some reason it just refuses to simply put that base64 back into the byte[]...there must be some other way to get it to work...
also, fyi I'm using ASP.NET MVC and Html.Hidden(...) which serializes the binary into base64 to begin with....
thanks!