How do you deserialise this json from jquery booking calendar pro?

Sunday, July 6, 2014

I am using a jquery plugin http://ift.tt/1mwQmT0 for a calendar control. The calendar returns JSON as below.



"YYYY-MM-DD":{"available": "", // Number of Available Items
"bind": 0, // Set if a day is a part of a group (0 = none; 1 = first day of a group; 2 = in the group; 3 = last day of a group)
"info": "", // Day informations
"notes": "", // Day notes
"price": "", // Price
"promo": "", // Promotional Price
"status": ""}, // Day status (none, available, booked, special, unavailable)
// Another day
"YYYY-MM-DD":{"available": "",
"bind": 0,
"info": "",
"notes": "",
"price": "",
"promo": "",
"status": ""}


Im struggling to understand how to convert this into an object, because of the nesting. Shouldn't the date be a name, rather than the actual data?


I know that I can use a dictionary like this,



var serializer = new JavaScriptSerializer();
var result = serializer.DeserializeObject(s);


but I would rather have a proper object. Can it be done with this JSON string?







http://ift.tt/1mwQmT2