c# - How to parse this JSON using JSON.Net? -
i cannot retrieve values inside queued_messages. im using c# here sample json data:
{ "queued_messages": [ "messageid082420150825111152", "messageid082420150825111153", "messageid082420150825111154" ] }
here code:
string json = httprequest.message.trim(); jobject jsonids = jobject.parse(json); queued_messages queuedmessageids = jsonids["queued_messages"].toobject<queued_messages>();
class of queued_messages:
public class queued_messages { [jsonproperty("queued_messages")] public string queued_messages { get; set; } }
queued_messages
must array
public class queued_messages { [jsonproperty("queued_messages")] public string[] queued_messages { get; set; } } jobject jsonids = jobject.parse(json); queued_messages queuedmessageids = jsonids.toobject<queued_messages>();
Comments
Post a Comment