Closed BryanWilhite closed 2 years ago
according to https://github.com/dotnet/runtime/issues/30180#issuecomment-557782346, [DataContract(Name = "opml")]
is the equivalent of [JsonObject("opml")]
<| @layomia
ITemporalExtensions.ToJObject
will be removed from the Core:
/// <summary>
/// Converts the specified <see cref="ITemporal"/> data
/// to <see cref="JObject"/>.
/// </summary>
/// <param name="data">the <see cref="ITemporal"/> data</param>
/// <param name="useJavaScriptCase">when <c>true</c> use snakecase</param>
/// <typeparam name="TData">a type derived from <see cref="ITemporal"/></typeparam>
public static JObject ToJObject<TData>(this ITemporal data, bool useJavaScriptCase) where TData : class, ITemporal
{
if (data == null) return null;
var settings = JsonSerializationUtility
.GetConventionalResolver<TData>(useJavaScriptCase)
.ToJsonSerializerSettings()
.WithConventionalSettings()
;
var jO = JObject.FromObject(data, JsonSerializer.Create(settings));
return jO;
}
new repo: https://github.com/BryanWilhite/SonghayCore.Newtonsoft :octocat: ✨
even though this is annoying and tedious adding this new package,
SonghayCore.Newtonsoft
, is a time-saving compromise compared to weeding out all of my Newtonsoft investments in one goideally this
netstandard2.0
package will not depend onSonghayCore
and should freeze in time or be locked in the Newtonsoft time frameSonghayCore.Newtonsoft
andSonghayCore.Newtonsoft.Tests
SonghayCore.Newtonsoft
NuGetnetstandard2.0
package