mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-04-12 12:07:05 +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>
|
||||
[PublicAPI]
|
||||
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);
|
||||
Print(serial);
|
||||
return Format(serial);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue