using System; using System.Collections; using System.Collections.Generic; using LitJson; #if !COMBAT_SERVER using UnityEngine; #else using System.Text.Json; #endif public class JsonManager { public static T FromJson(string json) { return JsonMapper.ToObject(json); #if !COMBAT_SERVER return JsonUtility.FromJson(json); #else return JsonSerializer.Deserialize(json); #endif } public static object FromJson(string json, Type type) { return JsonMapper.ToObject(json,type); #if !COMBAT_SERVER return JsonUtility.FromJson(json, type); #else JsonSerializerOptions jo = new JsonSerializerOptions(); // jo.IgnoreNullValues = true; return JsonSerializer.Deserialize(json,type,jo); #endif } public static string ToJson(object obj) { return JsonMapper.ToJson(obj); #if !COMBAT_SERVER return JsonUtility.ToJson(obj); #else return JsonSerializer.Serialize(obj); #endif } }