Loop through JSON object List

后端 未结 8 2005
忘掉有多难
忘掉有多难 2020-11-28 20:51

I am returning a List<> from a webservice as a List of JSON objects. I am trying to use a for loop to iterate through the list and grab the values out of the properties.

8条回答
  •  庸人自扰
    2020-11-28 21:06

    Here it is:

    success: 
        function(data) {
            $.each(data, function(i, item){
                alert("Mine is " + i + "|" + item.title + "|" + item.key);
            });
        }
    

    Sample JSON text:

    {"title": "camp crowhouse", 
    "key": "agtnZW90YWdkZXYyMXIKCxIEUG9zdBgUDA"}
    

提交回复
热议问题