您的位置:首页 > 文旅 > 美景 > 英文seo如何优化_浙江seo_店铺seo是什么意思_seo竞价

英文seo如何优化_浙江seo_店铺seo是什么意思_seo竞价

2025/5/2 16:48:04 来源:https://blog.csdn.net/weixin_47220117/article/details/147620417  浏览:    关键词:英文seo如何优化_浙江seo_店铺seo是什么意思_seo竞价
英文seo如何优化_浙江seo_店铺seo是什么意思_seo竞价

LitJson 是一个轻量级的 JSON 解析和生成库,广泛应用于 .NET 环境中。

优点:轻量级,易用,性能优秀,支持LINQ和自定义对象的序列化和反序列化。

public class LitJsonTest : MonoBehaviour

{

// Start is called before the first frame update

void Start()

{

PersonOfJson personOfJson1 = new();

personOfJson1.name = "keixo";

personOfJson1.age = 19;

//将数据转为字符串

string jsonStr1 = JsonMapper.ToJson(personOfJson1);

Debug.Log(jsonStr1);

//将字符串转为对象

PersonOfJson personOfJson4 = JsonMapper.ToObject<PersonOfJson>(jsonStr1);

//设有json数据

string jsonStr2 = @"{""name"" : ""zhaoxi"", ""age"" : 23 }";

PersonOfJson personOfJson5 = JsonMapper.ToObject<PersonOfJson>(jsonStr2);

Debug.Log(personOfJson5.name);

string jsonStr3 = @"

{

""name"" : ""alex"",

""id"" : 131231232,

""1"":[

{

""n1"" : ""n1"",

""n2"" : 1

},

{

""n1"" : ""n11"",

""n2"" : 2

}

]

}";

//可以把每个键值对都看成JsonData对象进行使用

JsonData jsonData = JsonMapper.ToObject(jsonStr3);

Debug.Log(jsonData["name"]);//alex

Debug.Log(jsonData["id"]);//131231232

JsonData jsonDate_Array = jsonData["1"];

//遍历数组

for(int i = 0; i < jsonDate_Array.Count; i ++)

{

Debug.Log("n1 =" + jsonDate_Array[i]["n1"]);

Debug.Log("n2 =" + jsonDate_Array[i]["n2"]);

}

}

}

[Serializable]

public class PersonOfJson

{

public string name;

public int age;

}

[Serializable]

public class PersonsOfJson

{

public List<PersonOfJson> personOfJsonList;

public int id;

}

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com