mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 03:57:32 +00:00
Extracted format method from print, so that the string can be returned to the caller without printing
This commit is contained in:
parent
7ed0ec2975
commit
b5c3aefe4c
1 changed files with 14 additions and 2 deletions
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue