I am using Jsonserializer.SerializeObject
trying to convert a byte[]
into a specific object.
The class structure of message is following:
public class ProjectMessageQueueMessage
{
public ProjectMessageQueueMessage();
public byte[] MessageData { get; set; }
public string MessageID { get; set; }
public string MessageType { get; set; }
}
And when I try and serialize it into a specific class, like so
byte[] output = JsonSerializer.SerializeObject<ExtendedScanMessage>(message.MessageData);
I get the following error:
Cannot convert from byte[] to ExtendedScanMessage
I can remove the type, like so:
byte[] output = JsonSerializer.SerializeObject(message.MessageData);
But then output will not be serialized to my class.
Am I missing something?