using Newtonsoft.Json; using Newtonsoft.Json.Converters; using Newtonsoft.Json.Utilities; using UnityEngine; namespace Unity.Services.Lobbies.Http { internal static class JsonHelpers { [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSplashScreen)] internal static void RegisterTypesForAOT() { AotHelper.EnsureType(); } internal static bool TryParseJson(this string @this, out T result) { var success = true; var settings = new JsonSerializerSettings { Error = (sender, args) => { success = false; args.ErrorContext.Handled = true; }, MissingMemberHandling = MissingMemberHandling.Ignore }; result = JsonConvert.DeserializeObject(@this, settings); return success; } } }