[Page data scripts] Dictionary object serialization?

22 views
Skip to first unread message

sche...@gmail.com

unread,
Apr 26, 2015, 9:03:44 PM4/26/15
to cass...@googlegroups.com
Hi,

I want to add a dictionary to the page data scripts.
But the serializer, which is used inside of cassette,
is printing the object the wrong way:

example:
var dictionary = new Dictionary<EnumXY, DtoXY>();
Bundles.AddPageData("cookieNames",    dictionary );

result:

(function(w){
var d=w['cookieNames']||(w['cookieNames']={});
d.Comparer={};
d.Count=7;
d.Keys=[0,2,1,3,4,5,6];
d.Values=[{"NAME":"NAMEVALUE","OTHERPROP":OTHERPROPVALUE}, ....];
}(window));



How to archieve the correct format?
{
      '0' : {"NAME":"NAMEVALUE","OTHERPROP":OTHERPROPVALUE},
      ....
}


I tried also other ways:

LIst<KeyValuePair<string, object>>()
-> Object {Capacity: 7, Count: 7}

and with ExpandoObject:
-> { }


Reply all
Reply to author
Forward
0 new messages