jquery how to deserialize json object

This question already has an answer here:

  • Parse JSON in JavaScript? [duplicate] 16 answers

  • You can do this with:

    var mydata; // [{"id":"67","name":"TestString"}]
    
    var json = $.parseJSON(mydata);
    

    the json variable will contain the de-serialized json object


    我认为这是你需要的:JSON.parse(data)

    success: function (data, status) {
              data = JSON.parse(data);
              $.each(data, function (dt) {
    
              var mydata = data.d;
    
              alert(mydata); // returns [{"id":"67","name":"TestString"}]
    
              $("#txt_speciality").tokenInput("add", mydata.id);
          });
    }
    

    如果你真的想使用jQuery,这里是功能但是,任何当前的浏览器都有功能

    JSON.parse()
    
    链接地址: http://www.djcxy.com/p/8480.html

    上一篇: JavaScript解析JSON

    下一篇: jquery如何反序列化json对象