what does d in json mean

what does d in json mean  using -'asp.net,jquery,ajax,json'

I have a .NET webmethod that I have called from jQuery.  The method returns some HTML markup that I display within a DIV element.

Once I have the response I use


My question is, what does the .d do? I don't like using code I don't fully understand?  Could I get the same result using Eval?

asked Oct 13, 2015 by vijayshukla80
0 votes

9 Answers

0 votes

Are you referring to the ADO.NET Data Services?

I remember hearing a presentation about the JSON returning this and I think its just a wrapper to ensure the payload is a JSON object as opposed to an array (which is the case of returning multiple entities).

Why 'd' specifically? I think I remember them saying something like 'well it had to be something'.

answered Oct 13, 2015 by ashish singh
0 votes

Here is your answer-


scroll down about half way and you well get a pretty thorough explaination.

answered Oct 13, 2015 by rajeevr642
0 votes

It returns the value of the field named 'd' in the object 'result'.

This question shows an example of how the JSON might look, notice the d: field.

answered Oct 13, 2015 by okesh.badhiye
0 votes

Based on this tutorial: JSON Web Service And jQuery with Visual Studio 2008

The Web Method returns a Product that is serialized in JSON format. Since there is not JSON type, the returned value is a String with JSON format.

On the client side, the ajax call returns a JSON.

The result looks like {d: 'returned-string-with-JSON-format'}

More exactly something like: {d:'{"ID":123,"Name":"Surface Pro 2"}'}

Note that 'returned-string-with-JSON-format' is a string not a JSON object so you cannot do result.d.ID.

Instead you need to convert it to JSON object by using JSON.parse(result.d) or eval(result.d)

At the end, what you really want is do this:

result = JSON.parse(result.d)

UPDATE Also consider this demo, where I use a JSON in string format and convert it to JSON object:

enter image description here

answered Oct 13, 2015 by sumit_jaiswalmca
0 votes

The d is part of the result returned by your .NET code. If you look at this code you should see a variable being set with the name d. If it is generated from serialized classes, then it probably sends along a member of that class with the name d.

answered Oct 13, 2015 by rajnipancholi
0 votes

may be very much useful link for those who want to really learn from scratch an example about wrapper class where the details in one class can never be dislosed to other class but can be indirectly accessed through various methods http://www.c-sharpcorner.com/Blogs/12038/wrapper-class-in-C-Sharp.aspx

answered Oct 13, 2015 by 20shahi
0 votes

ASPX Code Here:




C# Code Here:

public partial class Contact : Page
        protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
            int[] arr1 = new int[] { 1, 2 };
            ListBox1.SelectedValue = "1";
            ListBox1.SelectedValue = "4";


        void BindList()

            List lst = new List()
                new Product{Id=1,Name="Photo"},
                new Product{Id=2,Name="Photo"},
                new Product{Id=3,Name="Photo"},
                new Product{Id=4,Name="Photo"}
            ListBox1.DataSource = lst;
            ListBox1.DataTextField = "Name";
            ListBox1.DataValueField = "Id";

        public static string GetProducts()
            // instantiate a serializer
            JavaScriptSerializer TheSerializer = new JavaScriptSerializer();

            //optional: you can create your own custom converter
           // TheSerializer.RegisterConverters(new JavaScriptConverter[] { new MyCustomJson() });

            //var products = context.GetProducts().ToList();
            Product products = new Product() { Id = 1, Name = "Testing Services" };
            var TheJson = TheSerializer.Serialize(products);

            return TheJson;

answered Oct 13, 2015 by ajit.chavhan
0 votes

As others have pointed out, it returns the "d" member of the "result" object.
If you wanted to have "d" in a variable you could use this:

var property = "d";
var value = result[property];
answered Oct 13, 2015 by sachin valanju
0 votes

Its is very clear that $("#div").html(result.d); in your code

"result" is a object and d is property of "result".

Let explain,

if you create object like this,

var result{"id": "number", "d": "day"};

if we access the property of result is that using jquery


so we get result in html is

answered Oct 13, 2015 by r3tt