mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-06 08:16:19 +00:00
Extracted format method from print, so that the string can be returned to the caller without printing
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user