public object Deserialize(string value, JsonConverter converter) { //Integration.Implementation.LogAudit("TinCanStatementTarget Deserialize called", null); IDictionary objMap = converter.DeserializeJSONToMap(value); String typeField = null; if (objMap.Contains("objectType")) { typeField = (String)objMap["objectType"]; } TypeFieldJsonHelper typeFieldHelper = new TypeFieldJsonHelper(); Type targetType = typeFieldHelper.GetTypeFromString(typeField, typeof(TinCanActivity)); return converter.DeserializeJSON(value, targetType); }
public object Deserialize(string value, JsonConverter converter) { //Integration.Implementation.LogAudit("TinCanStatementTarget Deserialize called", null); IDictionary objMap = converter.DeserializeJSONToMap(value); string typeField = null; if (objMap.Contains("objectType")) { typeField = (string)objMap["objectType"]; } TypeFieldJsonHelper typeFieldHelper = new TypeFieldJsonHelper(); Type targetType = typeFieldHelper.GetTypeFromString(typeField, typeof(Activity)); return(converter.DeserializeJSON(value, targetType)); }
public object Deserialize(string value, JsonConverter converter) { //Integration.Implementation.LogAudit("TinCanActor Deserialize called", null); IDictionary objMap = converter.DeserializeJSONToMap(value); String typeField = null; if (objMap.Contains("objectType")) { typeField = (String)objMap["objectType"]; } TypeFieldJsonHelper typeFieldHelper = new TypeFieldJsonHelper(); Type targetType = typeFieldHelper.GetTypeFromString(typeField, typeof(Actor)); //Avoid infinite loop here, if type is this base class if (targetType.Equals(typeof(Actor))) { targetType = typeof(TinCanActor_JsonTarget); } return converter.DeserializeJSON(value, targetType); }
public object Deserialize(string value, JsonConverter converter) { //Integration.Implementation.LogAudit("TinCanActor Deserialize called", null); IDictionary objMap = converter.DeserializeJSONToMap(value); string typeField = null; if (objMap.Contains("objectType")) { typeField = (string)objMap["objectType"]; } TypeFieldJsonHelper typeFieldHelper = new TypeFieldJsonHelper(); Type targetType = typeFieldHelper.GetTypeFromString(typeField, typeof(Actor)); //Avoid infinite loop here, if type is this base class if (targetType.Equals(typeof(Actor))) { targetType = typeof(TinCanActor_JsonTarget); } return(converter.DeserializeJSON(value, targetType)); }