Json unity c# 解析器
Json parser with unity c#
我如何使用 Json、UWP 和 Unity 解析此 json uisng unity、c#?任何帮助谢谢
在 C#.NET
中将 JSON 字符串解析为 JSON 对象
{
"items":[
{
"created":"2017-04-14T09:56:30.593Z",
"createdBy":"12",
"name":"2",
"errorMessage":null,
"errorRetry":0,
"errorType":null,
"id":44,
"package":"12",
"partner":"1",
"reference":null,
"release":{
"category":null,
"configType":null,
"contributors":[
],
"created":"1",
"createdBy":null,
"files":[
],
"genre":null,
"id":15,
"isKeyRelease":false,
"metadata":[
],
"owner":null,
"owningTerritoryCode":"Worldwide",
"prices":[
],
"reference":"111111",
"resources":[
],
"scheduling":[
],
"scope":null,
"status":"None",
"title":"Test 3",
"updated":"0001-01-01T00:00:00Z"
},
"releaseId":15,
"scheduleDate":"2017-04-14T09:56:30.593Z",
"status":"Processed",
"step":"Complete",
"type":"Insert",
"updated":"2017-04-14T09:56:33.42Z"
},
],
"page":1,
"pageCount":3,
"pageSize":10,
"totalCount":24
}*
使用Json.Net回答:
var str =
"{\r\n \"items\":[\r\n {\r\n \"created\":\"2017-04-14T09:56:30.593Z\",\r\n \"createdBy\":\"12\",\r\n \"name\":\"2\",\r\n \"errorMessage\":null,\r\n \"errorRetry\":0,\r\n \"errorType\":null,\r\n \"id\":44,\r\n \"package\":\"12\",\r\n \"partner\":\"1\",\r\n \"reference\":null,\r\n \"release\":{\r\n \"category\":null,\r\n \"configType\":null,\r\n \"contributors\":[\r\n ],\r\n \"created\":\"1\",\r\n \"createdBy\":null,\r\n \"files\":[\r\n ],\r\n \"genre\":null,\r\n \"id\":15,\r\n \"isKeyRelease\":false,\r\n \"metadata\":[\r\n ],\r\n \"owner\":null,\r\n \"owningTerritoryCode\":\"Worldwide\",\r\n \"prices\":[\r\n ],\r\n \"reference\":\"111111\",\r\n \"resources\":[\r\n ],\r\n \"scheduling\":[\r\n ],\r\n \"scope\":null,\r\n \"status\":\"None\",\r\n \"title\":\"Test 3\",\r\n \"updated\":\"0001-01-01T00:00:00Z\"\r\n },\r\n \"releaseId\":15,\r\n \"scheduleDate\":\"2017-04-14T09:56:30.593Z\",\r\n \"status\":\"Processed\",\r\n \"step\":\"Complete\",\r\n \"type\":\"Insert\",\r\n \"updated\":\"2017-04-14T09:56:33.42Z\"\r\n }\r\n\r\n ],\r\n \"page\":1,\r\n \"pageCount\":3,\r\n \"pageSize\":10,\r\n \"totalCount\":24\r\n }";
var converter = JsonConvert.DeserializeObject<dynamic>(str);
Console.WriteLine(converter.totalCount); //Just a test: the result is 24!
Unity 有一个实用程序解析器,可以将 Json 转换为 class
我如何使用 Json、UWP 和 Unity 解析此 json uisng unity、c#?任何帮助谢谢 在 C#.NET
中将 JSON 字符串解析为 JSON 对象 {
"items":[
{
"created":"2017-04-14T09:56:30.593Z",
"createdBy":"12",
"name":"2",
"errorMessage":null,
"errorRetry":0,
"errorType":null,
"id":44,
"package":"12",
"partner":"1",
"reference":null,
"release":{
"category":null,
"configType":null,
"contributors":[
],
"created":"1",
"createdBy":null,
"files":[
],
"genre":null,
"id":15,
"isKeyRelease":false,
"metadata":[
],
"owner":null,
"owningTerritoryCode":"Worldwide",
"prices":[
],
"reference":"111111",
"resources":[
],
"scheduling":[
],
"scope":null,
"status":"None",
"title":"Test 3",
"updated":"0001-01-01T00:00:00Z"
},
"releaseId":15,
"scheduleDate":"2017-04-14T09:56:30.593Z",
"status":"Processed",
"step":"Complete",
"type":"Insert",
"updated":"2017-04-14T09:56:33.42Z"
},
],
"page":1,
"pageCount":3,
"pageSize":10,
"totalCount":24
}*
使用Json.Net回答:
var str =
"{\r\n \"items\":[\r\n {\r\n \"created\":\"2017-04-14T09:56:30.593Z\",\r\n \"createdBy\":\"12\",\r\n \"name\":\"2\",\r\n \"errorMessage\":null,\r\n \"errorRetry\":0,\r\n \"errorType\":null,\r\n \"id\":44,\r\n \"package\":\"12\",\r\n \"partner\":\"1\",\r\n \"reference\":null,\r\n \"release\":{\r\n \"category\":null,\r\n \"configType\":null,\r\n \"contributors\":[\r\n ],\r\n \"created\":\"1\",\r\n \"createdBy\":null,\r\n \"files\":[\r\n ],\r\n \"genre\":null,\r\n \"id\":15,\r\n \"isKeyRelease\":false,\r\n \"metadata\":[\r\n ],\r\n \"owner\":null,\r\n \"owningTerritoryCode\":\"Worldwide\",\r\n \"prices\":[\r\n ],\r\n \"reference\":\"111111\",\r\n \"resources\":[\r\n ],\r\n \"scheduling\":[\r\n ],\r\n \"scope\":null,\r\n \"status\":\"None\",\r\n \"title\":\"Test 3\",\r\n \"updated\":\"0001-01-01T00:00:00Z\"\r\n },\r\n \"releaseId\":15,\r\n \"scheduleDate\":\"2017-04-14T09:56:30.593Z\",\r\n \"status\":\"Processed\",\r\n \"step\":\"Complete\",\r\n \"type\":\"Insert\",\r\n \"updated\":\"2017-04-14T09:56:33.42Z\"\r\n }\r\n\r\n ],\r\n \"page\":1,\r\n \"pageCount\":3,\r\n \"pageSize\":10,\r\n \"totalCount\":24\r\n }";
var converter = JsonConvert.DeserializeObject<dynamic>(str);
Console.WriteLine(converter.totalCount); //Just a test: the result is 24!
Unity 有一个实用程序解析器,可以将 Json 转换为 class