Extracted format method from print, so that the string can be returned to the caller without printing

This commit is contained in:
Jack Kanarish
2018-03-14 14:19:28 -04:00
parent 7ed0ec2975
commit b5c3aefe4c

View File

@@ -90,6 +90,19 @@ namespace ICD.Common.Utils.Json
/// <param name="json"></param>
[PublicAPI]
public static void Print(string json)
{
var sb = Format(json);
IcdConsole.PrintLine(sb.ToString());
}
/// <summary>
/// Formats the JSON into a human-readable form.
/// </summary>
/// <param name="json"></param>
/// <returns></returns>
[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();
}
/// <summary>