mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-17 21:54:58 +00:00
feat: Shim for JSON formatting a serializable instance
This commit is contained in:
@@ -107,9 +107,21 @@ namespace ICD.Common.Utils.Json
|
|||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
[PublicAPI]
|
[PublicAPI]
|
||||||
public static void Print(object value)
|
public static void Print(object value)
|
||||||
|
{
|
||||||
|
string formatted = Format(value);
|
||||||
|
IcdConsole.PrintLine(formatted);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Serializes the given item and formats the JSON into a human-readable form.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="value"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[PublicAPI]
|
||||||
|
public static string Format(object value)
|
||||||
{
|
{
|
||||||
string serial = JsonConvert.SerializeObject(value);
|
string serial = JsonConvert.SerializeObject(value);
|
||||||
Print(serial);
|
return Format(serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user