From 5d0d491659e23ce546f2035a171314acc973a3b2 Mon Sep 17 00:00:00 2001 From: Chris Cameron Date: Mon, 9 Apr 2018 16:47:54 -0400 Subject: [PATCH] feat: Shim for JSON formatting a serializable instance --- ICD.Common.Utils/Json/JsonUtils.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ICD.Common.Utils/Json/JsonUtils.cs b/ICD.Common.Utils/Json/JsonUtils.cs index 8bb7a9c..6449cd7 100644 --- a/ICD.Common.Utils/Json/JsonUtils.cs +++ b/ICD.Common.Utils/Json/JsonUtils.cs @@ -107,9 +107,21 @@ namespace ICD.Common.Utils.Json /// [PublicAPI] public static void Print(object value) + { + string formatted = Format(value); + IcdConsole.PrintLine(formatted); + } + + /// + /// Serializes the given item and formats the JSON into a human-readable form. + /// + /// + /// + [PublicAPI] + public static string Format(object value) { string serial = JsonConvert.SerializeObject(value); - Print(serial); + return Format(serial); } ///