From b5c3aefe4cb5a3db5b9dcdf328c209d86546dab2 Mon Sep 17 00:00:00 2001 From: Jack Kanarish Date: Wed, 14 Mar 2018 14:19:28 -0400 Subject: [PATCH] Extracted format method from print, so that the string can be returned to the caller without printing --- ICD.Common.Utils/Json/JsonUtils.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ICD.Common.Utils/Json/JsonUtils.cs b/ICD.Common.Utils/Json/JsonUtils.cs index 4b49dfe..539ddfb 100644 --- a/ICD.Common.Utils/Json/JsonUtils.cs +++ b/ICD.Common.Utils/Json/JsonUtils.cs @@ -90,6 +90,19 @@ namespace ICD.Common.Utils.Json /// [PublicAPI] public static void Print(string json) + { + var sb = Format(json); + + IcdConsole.PrintLine(sb.ToString()); + } + + /// + /// Formats the JSON into a human-readable form. + /// + /// + /// + [PublicAPI] + public static string Format(string json) { int indent = 0; bool quoted = false; @@ -145,8 +158,7 @@ namespace ICD.Common.Utils.Json break; } } - - IcdConsole.PrintLine(sb.ToString()); + return sb.ToString(); } ///