mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
17 lines
473 B
C#
17 lines
473 B
C#
using System;
|
|
using Newtonsoft.Json;
|
|
|
|
namespace JNGame.Runtime.Util {
|
|
public static class JsonUtil {
|
|
public static string ToJson(object obj){
|
|
return JsonConvert.SerializeObject(obj);
|
|
}
|
|
|
|
public static T ToObject<T>(string txt){
|
|
return JsonConvert.DeserializeObject<T>(txt);
|
|
}
|
|
public static object ToObject(string txt,Type type){
|
|
return JsonConvert.DeserializeObject(txt,type);
|
|
}
|
|
}
|
|
} |