;-) have problem parse json response object.
i have following object:
public class conferences : list<conferencedata> { } public class conferencedata { private string _id; private string _title; private string _conference_code; private string _conference_state; private string _conference_type; private string _datetime_start; private int? _dial_type; private string _moderator_code; private int? _max_participants_count; public string id { { return _id; } set { _id = value; } } public string title { { return _title; } set { _title = value; } } public string datetime_start { { return _datetime_start; } set { _datetime_start = value; } } public int? duration { get; set; } public int? dial_type { { return _dial_type; } set { _dial_type = value; } } public string conference_type { { return _conference_type; } set { _conference_type = value; } } public string conference_state { { return _conference_state; } set { _conference_state = value; } } public bool? auto_recording { get; set; } public string cost_centre { get; set; } public int? participants_count { get; set; } public int? security_code { get; set; } public list<participant> participants { get; set; } public bool? broadcast_only_flag { get; set; } public string moderator_code { { return _moderator_code; } set { _moderator_code = value; } } and following logic:
string json = "[{\"conference\":{\"conference_code\":\"208475\",\"conference_state\":\"planned\",\"conference_type\":\"scheduled\",\"datetime_start\":\"2013-04-30t15:30:00+02:00\",\"dial_type\":1,\"id\":\"7\",\"moderator_code\":\"652929\",\"scheduled_participants_count\":null,\"title\":\"betreff\"}},{\"conference\":{\"conference_code\":\"502012\",\"conference_state\":\"planned\",\"conference_type\":\"scheduled\",\"datetime_start\":\"2013-04-30t16:30:00+02:00\",\"dial_type\":1,\"id\":\"11\",\"moderator_code\":\"133140\",\"scheduled_participants_count\":null,\"title\":\"betreff\"}},{\"conference\":{\"conference_code\":\"530437\",\"conference_state\":\"planned\",\"conference_type\":\"scheduled\",\"datetime_start\":\"2013-05-02t10:24:14+02:00\",\"dial_type\":1,\"id\":\"15\",\"moderator_code\":\"903257\",\"scheduled_participants_count\":null,\"title\":\"test ui\"}}]"; javascriptserializer serializer = new javascriptserializer(); conferences conferences = serializer.deserialize<conferences>(json); what's wrong? have try lot of different object typs,.. arry, list, dictionary, collection,... can't find right typ,... :-(
best regards! marc
just declare class
public class conference { public conferencedata conference; } and deserialize
var conferences = serializer.deserialize<list<conference>>(json);
Comments
Post a Comment