zoukankan      html  css  js  c++  java
  • json对象与json字符串互换

    json字符串转json对象:jQuery.parseJSON(jsonStr);                  /          var jsonObj= eval('(' + str + ')');    /        var jsonObj= str.parseJSON();     /     var jsonObj= JSON.parse(str);

    json对象转json字符串:JSON.stringify(jsonObj);                /       var last=jsonObj.toJSONString();

    JSON字符串:

    var str1 = "{ "name": "cxh", "sex": "man" }"; 

    JSON对象:

    var str2 = { "name": "cxh", "sex": "man" };

    手动拼接JSON字符串:

    public static string SetMsg(string msg, string msgcode)
         {
             return ("{"msg":"" + msg + "","msgcode":"" + msgcode + ""}");
    
          }
  • 相关阅读:
    bzoj 1054
    bzoj 1047
    bzoj 2761
    bzoj 1191
    bzoj 2748
    bzoj_1003 物流运输
    新的开始( [USACO08OCT]打井Watering Hole)
    map
    Generic Cow Protests-G——60分做法
    逆序对
  • 原文地址:https://www.cnblogs.com/BrokenIce/p/6063033.html
Copyright © 2011-2022 走看看