mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-15 12:45:01 +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>
|
/// <param name="json"></param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static void Print(string json)
|
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;
|
int indent = 0;
|
||||||
bool quoted = false;
|
bool quoted = false;
|
||||||
@@ -145,8 +158,7 @@ namespace ICD.Common.Utils.Json
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return sb.ToString();
|
||||||
IcdConsole.PrintLine(sb.ToString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user