public static object ParseAny(string json) { if (json == null || json == "" || json == "\"null\"") { return(null); } int integer; bool boolean; Type enumType; object enumValue; if (int.TryParse(json, out integer)) { // is integer return(integer); } else if (BooleanUtils.TryParse(json, out boolean)) { // is boolean return(boolean); } else if (json.Length > 2 && json.First() == '"' && json.Last() == '"') { if (EnumUtils.TryParse(json, out enumType, out enumValue)) { // is enum return(enumValue); } else { // is string return(json.Substring(1, json.Length - 2)); } } else if (json.Length > 2 && json.First() == '[' && json.Last() == ']') { // is list return(ListUtils.FromString(json)); } else if (json.Length > 2 && json.First() == '{' && json.Last() == '}') { // is object: User, Area, Card, Skill, Buff string[] splited = json.Trim(new char[] { '{', '}' }).Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); string guid = null; foreach (var item in splited) { if (item.Contains("\"guid\": \"")) { guid = item.Replace("\"guid\": \"", "").Trim('\"'); break; } } if (guid == null) { return(null); } object gameObject = Game.GetObject(guid); if (gameObject != null) { return(gameObject); } // is new object (Buff or SubSkill) gameObject = ParseToCreate(json); return(gameObject); } return(null); }