我尝试将json字符串输出到Visual Studio输出窗口中。但是调试。WriteLine函数不输出所有json。它打断了文本的某些部分。我该如何解决这个问题?这是一个错误还是2008年的一个选项?如果它是一个选项,我可以从哪里进行配置?
开发领域:VS 2008(.NET 3.5 Compact Framework(
代码:
text = "{rn "success": true,rn "message": null,rn "error_code": -1,rn "data": [rn {rn "zone_id": "23",rn "name": "MZONE 5",rn "kyos_code_pk": null,rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "22",rn "name": "MZONE 4",rn "kyos_code_pk": null,rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "21",rn "name": "MZONE 3",rn "kyos_code_pk": null,rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "20",rn "name": "MZONE 2",rn "kyos_code_pk": null,rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "19",rn "name": "MZONE 1",rn "kyos_code_pk": null,rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "18",rn "name": "ZONE 18",rn "kyos_code_pk": null,rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "17",rn "name": "ZONE 17",rn "kyos_code_pk": "17",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "16",rn "name": "ZONE 16",rn "kyos_code_pk": "16",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "15",rn "name": "ZONE 15",rn "kyos_code_pk": "15",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "14",rn "name": "ZONE 14",rn "kyos_code_pk": "14",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "13",rn "name": "ZONE 13",rn "kyos_code_pk": "13",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "12",rn "name": "ZONE 12",rn "kyos_code_pk": "12",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "11",rn "name": "ZONE 11",rn "kyos_code_pk": "11",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "10",rn "name": "ZONE 10",rn "kyos_code_pk": "10",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "9",rn "name": "ZONE 9",rn "kyos_code_pk": "9",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "8",rn "name": "ZONE 8",rn "kyos_code_pk": "8",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "6",rn "name": "ZONE 6",rn "kyos_code_pk": "6",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "5",rn "name": "ZONE 5",rn "kyos_code_pk": "5",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "4",rn "name": "ZONE 4",rn "kyos_code_pk": "4",rn "color": "#000000",rn "sort_order": "0",rn "status": "1"rn },rn {rn "zone_id": "7",rn "name": "ZONE 7",rn "kyos_code_pk": "7",rn "color": "#000000",rn "sort_order": "1",rn "status": "1"rn },rn {rn "zone_id": "1",rn "name": "ZONE 1",rn "kyos_code_pk": "1",rn "color": "#800000",rn "sort_order": "1",rn "status": "1"rn },rn {rn "zone_id": "3",rn "name": "ZONE 3",rn "kyos_code_pk": "3",rn "color": "#000000",rn "sort_order": "2",rn "status": "1"rn },rn {rn "zone_id": "2",rn "name": "ZONE 2",rn "kyos_code_pk": "2",rn "color": "#0000ff",rn "sort_order": "5",rn "status": "1"rn }rn ]rn}";
Debug.WriteLine(text);
预期输出:
{
"success": true,
"message": null,
"error_code": -1,
"data": [
{
"zone_id": "23",
"name": "MZONE 5",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "22",
"name": "MZONE 4",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "21",
"name": "MZONE 3",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "20",
"name": "MZONE 2",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "19",
"name": "MZONE 1",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "18",
"name": "ZONE 18",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "17",
"name": "ZONE 17",
"kyos_code_pk": "17",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "16",
"name": "ZONE 16",
"kyos_code_pk": "16",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "15",
"name": "ZONE 15",
"kyos_code_pk": "15",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "14",
"name": "ZONE 14",
"kyos_code_pk": "14",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "13",
"name": "ZONE 13",
"kyos_code_pk": "13",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "12",
"name": "ZONE 12",
"kyos_code_pk": "12",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "11",
"name": "ZONE 11",
"kyos_code_pk": "11",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "10",
"name": "ZONE 10",
"kyos_code_pk": "10",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "9",
"name": "ZONE 9",
"kyos_code_pk": "9",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "8",
"name": "ZONE 8",
"kyos_code_pk": "8",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "6",
"name": "ZONE 6",
"kyos_code_pk": "6",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "5",
"name": "ZONE 5",
"kyos_code_pk": "5",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "4",
"name": "ZONE 4",
"kyos_code_pk": "4",
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "7",
"name": "ZONE 7",
"kyos_code_pk": "7",
"color": "#000000",
"sort_order": "1",
"status": "1"
},
{
"zone_id": "1",
"name": "ZONE 1",
"kyos_code_pk": "1",
"color": "#800000",
"sort_order": "1",
"status": "1"
},
{
"zone_id": "3",
"name": "ZONE 3",
"kyos_code_pk": "3",
"color": "#000000",
"sort_order": "2",
"status": "1"
},
{
"zone_id": "2",
"name": "ZONE 2",
"kyos_code_pk": "2",
"color": "#0000ff",
"sort_order": "5",
"status": "1"
}
]
}
实际输出:
{
"success": true,
"message": null,
"error_code": -1,
"data": [
{
"zone_id": "23",
"name": "MZONE 5",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "22",
"name": "MZONE 4",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "21",
"name": "MZONE 3",
"kyos_code_pk": null,
"color": "#000000",
"sort_order": "0",
"status": "1"
},
{
"zone_id": "20",
"name": "MZONE 2",
"kyos_code_pk": null,
"color": "#000000",
"sort_order":
替代解决方案(拆分文本(:
string[] jsonParts = text.Split(',');
for (int i = 0; i < jsonParts.Length; i++)
{
string part = "";
if (i != 0)
{
part = ",";
}
part += jsonParts[i];
Debug.Write(part);
}
替代解决方案(SPLIT TEXT(:
string[] jsonParts = text.Split(',');
for (int i = 0; i < jsonParts.Length; i++)
{
string part = "";
if (i != 0)
{
part = ",";
}
part += jsonParts[i];
Debug.Write(part);
}