I try to make a JSON web service with use asp.net 3.5 and the result returning in xml like this :
<string xmlns="http://.../">
[{"HatId":9,"HatAdi":"SARISU - GÜZELOBA","LevhaAciklama":"KL08"}]
</string>
I used that LINK example and I realized that sample also returning as a xml.
    [WebMethod]
    [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
    public string HatlarJSON(String HatAdi)
    {
        Hatlar[] allRecords = null;
        string sql = "SELECT * FROM Table";
        SqlConnection con = new SqlConnection("Data Source="ip";Initial Catalog="";User Id="";Password="";Integrated Security=False");
        con.Open();
        using (var command = new SqlCommand(sql, con))
        {
            using (var reader = command.ExecuteReader())
            {
                var list = new List<Hatlar>();
                while (reader.Read())
                    list.Add(new Hatlar { HatId = reader.GetInt32(0), HatAdi = reader.GetString(1), LevhaAciklama = reader.GetString(2) });
                allRecords = list.ToArray();
            }
        }
        return new JavaScriptSerializer().Serialize(allRecords);
    }
How can I return the solution with no xml ?
Anyone have an idea ?
 
     
    