public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { if (reader.Value is string strVal) { return(ActionParameter.FromName(strVal)); } var props = serializer.Deserialize(reader, typeof(Dictionary <string, string>)) as Dictionary <string, string>; string name = GetValueOrDefault(props, nameof(ActionParameter.Name), "NO_NAME"); string type = GetValueOrDefault(props, nameof(ActionParameter.Type), "NO_TYPE"); bool optional = GetValueOrDefault(props, nameof(ActionParameter.Optional), "") == "true"; ActionParameter parameter = new ActionParameter(name, type, optional); return(parameter); }