Parsing Serialized JSON DataSet using Jquery

Posted by Zachary Carter on Stack Overflow See other posts from Stack Overflow or by Zachary Carter
Published on 2010-05-06T22:51:03Z Indexed on 2010/05/06 22:58 UTC
Read the original article Hit count: 297

Filed under:
|
|

Hello all, and thanks for reading.

I wrote a web service which is called through jsonp, and returns a .Net 3.5 DataSet which I then want to parse using jquery. It appears that the getJson() method is working fine as far as parsing the json goes. The following request -

            $.getJSON("http://localhost:80/ws.asmx/Example?format=json&callback=?", function(data) {
            alert(data.d);
        });

results in -

{"Tables": [

{

  "Rows": [

    {

      "CASE_TYP_CD": "M",

      "CASE_TYP_DESC": "MOVING VIOLATION",

      "AUTO_GENERATE": "Y",

      "CONFIDENTIAL_FLG": "N"

    },

    {

      "CASE_TYP_CD": "T",

      "CASE_TYP_DESC": "TRUANCY/FAILURE TO ATTEND SCHOOL",

      "AUTO_GENERATE": "Y",

      "CONFIDENTIAL_FLG": "N"

    },

    {

      "CASE_TYP_CD": "J",

      "CASE_TYP_DESC": "JUVENILE",

      "AUTO_GENERATE": "Y",

      "CONFIDENTIAL_FLG": "N"

    }...

Well I'm kind of new at this whole json thing and I can't figure out how to gain access to the values held in the nodes.

I was thinking it would be something like -

$.each("CASE_TYP_CD", function() { //code goes here });

But that doesn't seem to be working.

Could anyone help me out with this?

Thanks in advance!

© Stack Overflow or respective owner

Related posts about parsing

Related posts about JSON