From 0a3c54e0a7a9f1e8939f77b003e30824db9e0975 Mon Sep 17 00:00:00 2001 From: huyfei Date: Sun, 4 Feb 2024 16:47:23 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=9B=B4=E6=96=B0=E5=86=85=E6=A0=B8?= =?UTF-8?q?=E7=9A=84=20JsonParser=20=E8=A7=A3=E6=9E=90=E5=99=A8=E4=B8=BA?= =?UTF-8?q?=20JsonConvert?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/GuruCore/Runtime/Common/JsonParser.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Runtime/GuruCore/Runtime/Common/JsonParser.cs b/Runtime/GuruCore/Runtime/Common/JsonParser.cs index c044c7a..0b3bf7f 100644 --- a/Runtime/GuruCore/Runtime/Common/JsonParser.cs +++ b/Runtime/GuruCore/Runtime/Common/JsonParser.cs @@ -1,10 +1,12 @@ + + namespace Guru { using System; + using Newtonsoft.Json; using UnityEngine; - using Guru.LitJson; public static class JsonParser { @@ -49,7 +51,8 @@ namespace Guru { try { - return JsonMapper.ToObject(jsonStr); + // return JsonMapper.ToObject(jsonStr); + return JsonConvert.DeserializeObject(jsonStr); } catch (Exception e) { @@ -69,6 +72,7 @@ namespace Guru { try { + /* if (!prettyFormat) { return JsonMapper.ToJson(obj); @@ -83,7 +87,10 @@ namespace Guru JsonMapper.ToJson(obj, writer); return writer.ToString(); } + */ + var formatting = prettyFormat ? Formatting.Indented : Formatting.None; + return JsonConvert.SerializeObject(obj, formatting); } catch (Exception e) {