I am trying to deserialize a JSON using Newtonsoft. However when deserializing a class "Opc.Ua.NodeId" to System.Type. It throws an exception "Error converting value "Opc.Ua.NodeId" to type 'System.Type'. Path 'SessionId.Type'.".
When there is System.Boolean or other System types, it converts without any error.
{
"Status": {
"Type": "System.Boolean",
"Value": true
},
"ServerId": {
"Type": "System.String",
"Value": {
"olaBola": "ns=3;i=422970276"
}
},
"SessionId": {
"Type": "Opc.Ua.NodeId",
"Value": {
"Identifier": "ns=3;i=422970276"
}
}
}
Class:
public class ExtendedAttribute
{
public Type? Type { get; set; }
public object? Value { get; set; }
}
Code:
JsonConvert.DeserializeObject<Dictionary<string, ExtendedAttribute>>(jsonText);
How to resolve this?