Here is my code:
private void OnIncomingData(string data)
{
Console.WriteLine("RECEIVED: " + data);
TransferData transfer = JsonConvert.DeserializeObject<TransferData>(data);
}
I receive an error:
JsonReaderException: Unexpected character encountered while parsing value: {. Path 'data', line 1, position 26.
Here is what my Console.WriteLine
gives:
RECEIVED: {"header":"0x001","data":{"connectionId":"85"},"connectionId":85}
Here is my TransferData
class:
public class TransferData
{
public string header;
public string data;
public int connectionId;
}
As you can see the json string is correct. Why than I receive this error? How can I fix it?