weixin_38001439
酷酷的小魏丶
2017-05-26 02:15
采纳率: 58.8%
浏览 1.4k

C#后台通过用string获取到了前台一组二维数组,请问可以怎样解析出来。

string lists=“[["2017-05-26","2017-05-26","1","1"],["2017-05-25","2017-05-25","1","1"]]”;

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • showbo
    已采纳

    反序列化为对象就行了,需要导入Newtonsoft.Json.Net20.dll类库

    
            string lists="[[\"2017-05-26\",\"2017-05-26\",\"1\",\"1\"],[\"2017-05-25\",\"2017-05-25\",\"1\",\"1\"]]";
            List<List<string>> mylist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<List<string>>>(lists);
            foreach (List<string> l in mylist)
                foreach (string s in l) Response.Write(s + "<br>");
    
    点赞 评论
  • a196817
    挡都挡不住 2017-05-26 02:43

    用split分开成数组:

    比如
    String lists = "jack,20,男";
    String[] info = lists.split(",");

    点赞 评论

相关推荐