CodeLiturgy.Dashboard/CodeLiturgy/Tools/JsonTools.cs

17 lines
472 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Encodings.Web;
namespace PerformanceSolution.Tools
{
public static class JsonTools
{
public static Dictionary<string, object?> ConvertFromObjectToDictionary(object arg)
{
var properties = arg.GetType().GetProperties();
return properties.ToDictionary(property => property.Name, property => property.GetValue(arg));
}
}
}