// SetValue gets called by Json.Net during deserialization. // The value parameter has the string value read from the JSON; // target is the object on which to set the (possibly truncated) value. public void SetValue(object target, object value) { string s = (string)value; if (s != null && s.Length > MaxLength) { s = s.Substring(0, MaxLength); } InnerValueProvider.SetValue(target, s); }
// GetValue is called by Json.Net during serialization. // The target parameter has the object from which to read the string; // the return value is a string that gets written to the JSON. public object GetValue(object target) { return(InnerValueProvider.GetValue(target)); }