#2996 added GlobalSettings.DebugMode switch for JSON formatting indentation.
This commit is contained in:
committed by
Sebastiaan Janssen
parent
18cd508804
commit
d3c4aace16
@@ -4,6 +4,7 @@ using System.Reflection;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Umbraco.Core.Configuration;
|
||||
|
||||
namespace Umbraco.Core.Serialization
|
||||
{
|
||||
@@ -60,7 +61,8 @@ namespace Umbraco.Core.Serialization
|
||||
/// <returns></returns>
|
||||
public IStreamedResult ToStream(object input)
|
||||
{
|
||||
string s = JsonConvert.SerializeObject(input, Formatting.Indented, _settings);
|
||||
var formatting = GlobalSettings.DebugMode ? Formatting.Indented : Formatting.None;
|
||||
string s = JsonConvert.SerializeObject(input, formatting, _settings);
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(s);
|
||||
MemoryStream ms = new MemoryStream(bytes);
|
||||
|
||||
@@ -69,4 +71,4 @@ namespace Umbraco.Core.Serialization
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user