Debug.WriteLine 不输出所有 json 字符串

Debug.WriteLine doesnt output all json string

我尝试将json字符串输出成Visual Studio输出window。但是 Debug.WriteLine 函数并没有输出所有 json。它打破了文本的某些部分。 我该如何解决这个问题?这是 vs 2008 中的错误还是选项?如果它是一个选项,我可以从哪里配置?

开发领域: VS 2008 (.NET 3.5 Compact Framework)

代码:

    text = "{\r\n  \"success\": true,\r\n  \"message\": null,\r\n  \"error_code\": -1,\r\n  \"data\": [\r\n    {\r\n      \"zone_id\": \"23\",\r\n      \"name\": \"MZONE 5\",\r\n      \"kyos_code_pk\": null,\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"22\",\r\n      \"name\": \"MZONE 4\",\r\n      \"kyos_code_pk\": null,\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"21\",\r\n      \"name\": \"MZONE 3\",\r\n      \"kyos_code_pk\": null,\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"20\",\r\n      \"name\": \"MZONE 2\",\r\n      \"kyos_code_pk\": null,\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"19\",\r\n      \"name\": \"MZONE 1\",\r\n      \"kyos_code_pk\": null,\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"18\",\r\n      \"name\": \"ZONE 18\",\r\n      \"kyos_code_pk\": null,\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"17\",\r\n      \"name\": \"ZONE 17\",\r\n      \"kyos_code_pk\": \"17\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"16\",\r\n      \"name\": \"ZONE 16\",\r\n      \"kyos_code_pk\": \"16\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"15\",\r\n      \"name\": \"ZONE 15\",\r\n      \"kyos_code_pk\": \"15\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"14\",\r\n      \"name\": \"ZONE 14\",\r\n      \"kyos_code_pk\": \"14\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"13\",\r\n      \"name\": \"ZONE 13\",\r\n      \"kyos_code_pk\": \"13\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"12\",\r\n      \"name\": \"ZONE 12\",\r\n      \"kyos_code_pk\": \"12\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"11\",\r\n      \"name\": \"ZONE 11\",\r\n      \"kyos_code_pk\": \"11\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"10\",\r\n      \"name\": \"ZONE 10\",\r\n      \"kyos_code_pk\": \"10\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"9\",\r\n      \"name\": \"ZONE 9\",\r\n      \"kyos_code_pk\": \"9\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"8\",\r\n      \"name\": \"ZONE 8\",\r\n      \"kyos_code_pk\": \"8\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"6\",\r\n      \"name\": \"ZONE 6\",\r\n      \"kyos_code_pk\": \"6\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"5\",\r\n      \"name\": \"ZONE 5\",\r\n      \"kyos_code_pk\": \"5\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"4\",\r\n      \"name\": \"ZONE 4\",\r\n      \"kyos_code_pk\": \"4\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"0\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"7\",\r\n      \"name\": \"ZONE 7\",\r\n      \"kyos_code_pk\": \"7\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"1\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"1\",\r\n      \"name\": \"ZONE 1\",\r\n      \"kyos_code_pk\": \"1\",\r\n      \"color\": \"#800000\",\r\n      \"sort_order\": \"1\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"3\",\r\n      \"name\": \"ZONE 3\",\r\n      \"kyos_code_pk\": \"3\",\r\n      \"color\": \"#000000\",\r\n      \"sort_order\": \"2\",\r\n      \"status\": \"1\"\r\n    },\r\n    {\r\n      \"zone_id\": \"2\",\r\n      \"name\": \"ZONE 2\",\r\n      \"kyos_code_pk\": \"2\",\r\n      \"color\": \"#0000ff\",\r\n      \"sort_order\": \"5\",\r\n      \"status\": \"1\"\r\n    }\r\n  ]\r\n}";
    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);
 }

备选方案(拆分文本):

string[] jsonParts = text.Split(',');
for (int i = 0; i < jsonParts.Length; i++)
{
  string part = "";
  if (i != 0)
  {
     part = ",";
  }
  part += jsonParts[i];
  Debug.Write(part);
 }