From 3c2ae389f49571f215ebd71034d03fb87cef1358 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Tue, 27 Feb 2024 17:18:58 +0100 Subject: [PATCH] Remove Newtonsoft.Json from Multi URL picker (#15768) --- .../PropertyEditors/MultiUrlPickerValueEditor.cs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs b/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs index 93f805f1d4..7e760d0f69 100644 --- a/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs +++ b/src/Umbraco.Infrastructure/PropertyEditors/MultiUrlPickerValueEditor.cs @@ -2,9 +2,7 @@ // See LICENSE for more details. using System.Runtime.Serialization; -using System.Text.Json.Nodes; using Microsoft.Extensions.Logging; -using Newtonsoft.Json.Linq; using Umbraco.Cms.Core.IO; using Umbraco.Cms.Core.Models; using Umbraco.Cms.Core.Models.ContentEditing; @@ -149,13 +147,8 @@ public class MultiUrlPickerValueEditor : DataValueEditor, IDataValueReference public override object? FromEditor(ContentPropertyData editorValue, object? currentValue) { - // FIXME: get rid of Json.NET here - // FIXME: consider creating an object deserialization method on IJsonSerializer instead of relying on deserializing serialized JSON here (and likely other places as well) - var value = editorValue.Value is JArray jArray - ? jArray.ToString() - : editorValue.Value is JsonArray jsonArray - ? jsonArray.ToJsonString() - : string.Empty; + // the editor value is a JsonArray, which produces deserialize-able JSON with ToString() (deserialization happens later on) + var value = editorValue.Value?.ToString(); if (string.IsNullOrEmpty(value)) {