using LitJson; using System.Collections.Generic; namespace GFGGame { public class JsonUtil { private static Dictionary _obj = new Dictionary(); public static string createJsonStr(params object[] args) { _obj.Clear(); if(args != null) { int count = args.Length; for(int i = 0; i < count; i+=2) { _obj.Add((string)args[i], args[i+1]); } } return JsonMapper.ToJson(_obj); } public static Dictionary createJsonDic(params object[] args) { Dictionary dic = new Dictionary(); if(args != null) { int count = args.Length; for(int i = 0; i < count; i+=2) { dic.Add((string)args[i], args[i+1]); } } return dic; } } }