v14: Refactor and enhance System.Text.Json converters (#15960)
* Update JsonUdiConverter to support Udi, GuidUdi and StringUdi types * Require boolean (like) value and rename to JsonFuzzyBooleanConverter * Add read/write only JsonConverters and align naming * Rename SystemTextJsonSerializer to DefaultJsonSerializer * Rename SystemTextConfigurationEditorJsonSerializer to DefaultConfigurationEditorJsonSerializer * Add JsonUdiRangeConverter * Rename JsonFuzzyBooleanConverter back to JsonBooleanConverter * Fix value type check in JsonObjectConverter * Revert class names * Updated tests * Post fix after merge. --------- Co-authored-by: Bjarke Berg <mail@bergmania.dk>
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
namespace Umbraco.Cms.Core.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Provides functionality to serialize objects or value types to JSON and to deserialize JSON into objects or value types, used for data type configuration.
|
||||
/// </summary>
|
||||
public interface IConfigurationEditorJsonSerializer : IJsonSerializer
|
||||
{
|
||||
}
|
||||
{ }
|
||||
|
||||
@@ -1,8 +1,27 @@
|
||||
namespace Umbraco.Cms.Core.Serialization;
|
||||
|
||||
/// <summary>
|
||||
/// Provides functionality to serialize objects or value types to JSON and to deserialize JSON into objects or value types.
|
||||
/// </summary>
|
||||
public interface IJsonSerializer
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts the specified <paramref name="input" /> into a JSON string.
|
||||
/// </summary>
|
||||
/// <param name="input">The input.</param>
|
||||
/// <returns>
|
||||
/// A JSON string representation of the value.
|
||||
/// </returns>
|
||||
string Serialize(object? input);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Parses the text representing a single JSON value into an instance of the type specified by a generic type parameter.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The target type of the JSON value.</typeparam>
|
||||
/// <param name="input">The JSON input to parse.</param>
|
||||
/// <returns>
|
||||
/// A <typeparamref name="T" /> representation of the JSON value.
|
||||
/// </returns>
|
||||
T? Deserialize<T>(string input);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user