Q: How to loop through Json object to bind data to dropdownlist I am trying to loop through a Json object to populate data in dropdown but getting undefined.I don't know where i am doing wrong.Below is the code:
My Javascript code:
function CIOAnalyzeByDropDown() {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            //url: '../../CIODashboard.svc/GetAnalyzedDropDownDetails',
            url: '../../CIODashboard/GetAnalyzedDropDownDetails',
            dataType: "json",
            processData: false,
            success: function (data) {
                debugger;
                //var s = JSON.parse(data.d);
                var s = JSON.stringify(data);
                debugger;
                for (x in s) {

                    if (s[x].dropDowns == "Created_Date") {
                        $("#drop1").append("<option value=" + s[x].dropDowns + "  selected >" + s[x].dropDowns + "</option>");
                    }
                    else {
                        $("#drop1").append("<option value=" + s[x].dropDowns + ">" + s[x].dropDowns + "</option>");
                    }
                }




            },
            error: function (result) {
                alert(result + "error occured while fetching the ProjectsSummary values");
            }
        });
    }

My Contoller code :
 public string GetAnalyzedDropDownDetails()
    {
        string jsonString = string.Empty;
        List<projectDropDowns> itemList = new List<projectDropDowns>();

        using (SqlConnection con = new SqlConnection(strConnection))
        {
            con.Open();
            SqlCommand cmd = con.CreateCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "usp_AnalyzeByDropdown";
            cmd.CommandTimeout = 60;

            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataTable dtresult = new DataTable();
            da.Fill(dtresult);

            if (dtresult.Rows.Count > 0)
            {
                for (int i = 0; i < dtresult.Rows.Count; i++)
                {
                    projectDropDowns info = new projectDropDowns();
                    info.dropDowns = "" + dtresult.Rows[i]["COLUMN_NAME"];
                    itemList.Add(info);
                    jsonString = SerializeJSon<List<projectDropDowns>>(itemList);
                    //return jsonString;
                }
            }
            con.Close();
        }
        return jsonString;
    }

Serialize Json method :
public string SerializeJSon<T>(T t)
    {
        MemoryStream stream = new MemoryStream();
        DataContractJsonSerializer ds = new DataContractJsonSerializer(typeof(T));
        ds.WriteObject(stream, t);
        string jsonString = Encoding.UTF8.GetString(stream.ToArray());
        stream.Close();
        return jsonString;
    }

It is returning an array object containing 3 values in it but in my dropdown it is showing Undefined.
Any help would be much appreciated.

A: issue is resolved by directly iterating the data and by not parsing it into json as the data coming is an array.
 function CIOAnalyzeByDropDown() {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            //url: '../../CIODashboard.svc/GetAnalyzedDropDownDetails',
            url: '../../CIODashboard/GetAnalyzedDropDownDetails',
            dataType: "json",
            processData: false,
            success: function (data) {
                debugger;
                //var s = JSON.parse(data.d);
                //var s = JSON.stringify(data);

                for (x in data) {

                    if (data[x].dropDowns == "Created_Date") {
                        $("#drop1").append("<option value=" + data[x].dropDowns + "  selected >" + data[x].dropDowns + "</option>");
                    }
                    else {
                        $("#drop1").append("<option value=" + data[x].dropDowns + ">" + data[x].dropDowns + "</option>");
                    }
                }
            },
            error: function (result) {
                alert(result + "error occured while fetching the ProjectsSummary values");
            }
        });
    }

