* 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>
16 lines
490 B
C#
16 lines
490 B
C#
using System.Text.Json;
|
|
|
|
namespace Umbraco.Cms.Infrastructure.Serialization;
|
|
|
|
/// <summary>
|
|
/// Converts a string to or from JSON, interning the string when reading.
|
|
/// </summary>
|
|
public sealed class JsonStringInternConverter : ReadOnlyJsonConverter<string>
|
|
{
|
|
/// <inheritdoc />
|
|
public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
|
=> reader.GetString() is string value
|
|
? string.Intern(value)
|
|
: null;
|
|
}
|