mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-14 04:58:33 +00:00
feat: Shim for JSON formatting a serializable instance
This commit is contained in:
parent
0fd8d91850
commit
5d0d491659
1 changed files with 13 additions and 1 deletions
|
|
@ -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>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue