added extension.js, trying to add legacy sprites for tree icons, updates tree icon filters (still not working)
This commit is contained in:
33
src/Umbraco.Core/Serialization/JsonToStringConverter.cs
Normal file
33
src/Umbraco.Core/Serialization/JsonToStringConverter.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace Umbraco.Core.Serialization
|
||||
{
|
||||
/// <summary>
|
||||
/// This is used in order to deserialize a json object on a property into a json string since the property's type is 'string'
|
||||
/// </summary>
|
||||
internal class JsonToStringConverter : JsonConverter
|
||||
{
|
||||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.ValueType == typeof(string))
|
||||
{
|
||||
return reader.Value;
|
||||
}
|
||||
// Load JObject from stream
|
||||
JObject jObject = JObject.Load(reader);
|
||||
return jObject.ToString();
|
||||
}
|
||||
|
||||
public override bool CanConvert(Type objectType)
|
||||
{
|
||||
return typeof(string).IsAssignableFrom(objectType);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user