This project has moved. For the latest updates, please go here.


May 17, 2012 at 7:44 AM
Edited May 17, 2012 at 7:49 AM
class MyArray<T>{
 Dictionary<int, T> _Dic = new Dictionary<int, T>();
  public int Properties1 { get; set; }
  public string Properties2 { get; set; }
  public T this[int i]{
    get { return _Dic[i]; }
    set { _Dic[i] = value; }

  MyArray<int> obj = new MyArray<int>();

  obj.Properties1 = 1234;
  obj.Properties2 = "neo";
  obj[0] = 10;
  obj[1] = 20;


 //Serialized received:

 // Expected serialized object:
   { [10,20] , "Properties1":1234,"Properties2":"neo" }


In browser this can be achieved by the following code:

var a = [10,20];
a.property1 = 1234;
a.property2 = "neo";


I havn't come across a single place where this issue is adresses.

Can someone put light into it?

May 17, 2012 at 8:57 AM

Please find the detailed illustration at

May 17, 2012 at 12:08 PM

JavaScript != JSON. That's not valid JSON.

May 18, 2012 at 4:43 AM
Edited May 18, 2012 at 4:49 AM

Thanks James for the reply.

I like the way you have replied.

I agree that is not a valid JSON and the point I want to emphasize is that when the concept of Array with properties, then there is no valid JSON for it ?

ECMA also doesn't adresses this issue.

We can create such object in server and in client, but the transport DTO (i.e. the JSON) is not having the support for it, yet !

Do you agree!

If so, how to address it ? Moreover you have mentioned JSON.NET - "Serialize all the things" :)


Below are links detailing my findings: