add girIgnore

This commit is contained in:
jrojas
2026-06-23 19:03:17 +02:00
parent 52335cc5fa
commit 95c9039c78
321 changed files with 84 additions and 12748 deletions
+48
View File
@@ -0,0 +1,48 @@
using Newtonsoft.Json.Linq;
namespace audit_logs.Utils;
public static class JsonClean
{
public static JObject CleanJObject(JObject obj)
{
var properties = obj.Properties().ToList();
foreach (var property in properties)
{
if (property.Value.Type == JTokenType.Null)
{
// Eliminar la propiedad si el valor es null
property.Remove();
}
else if (property.Value.Type == JTokenType.Object)
{
// Limpieza para objetos anidados
property.Value = CleanJObject((JObject)property.Value);
}
else if (property.Value.Type == JTokenType.Array)
{
// Limpieza para arrays, aplicando limpieza a cada objeto dentro del array
property.Value = CleanJArray((JArray)property.Value);
}
}
return obj;
}
public static JArray CleanJArray(JArray array)
{
var cleanedArray = new JArray();
foreach (var item in array)
{
if (item.Type == JTokenType.Object)
{
cleanedArray.Add(CleanJObject((JObject)item));
}
else if (item.Type != JTokenType.Null)
{
cleanedArray.Add(item);
}
}
return cleanedArray;
}
}