Hi all,
I have a List
I add an object that contains Json data to this list in a foreach loop: posts.Add(statusJson);
Now this Json object (statusJson) contains these fields : name,message and created_time. I would like to sort the list by created_time
Any suggestions?

Abhishek GoswamiRank #751 · 3.1K reputationPosted Jan 16, 2014, 9:27 PM EST
Avuya MxoliRank #7,940 · 231 reputationPosted Jan 16, 2014, 9:50 PM EST
then: posts.Add(statusJson);
All in the foreach. So your suggestion will not work,maybe you can suggest how I can do it on the client side(javascript) because at least there I can access the individual values of my json object. Thanks again
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 16, 2014, 9:55 PM EST
hi,
why you require json object here?
Instead of Json object you can use class object which has similar property.
if you have class object than you can easily sort this..
hope this will help you.
Avuya MxoliRank #7,940 · 231 reputationPosted Jan 16, 2014, 10:14 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 16, 2014, 10:32 PM EST
are you required json data with in your application?
if no than de-serialize it in to class and sort it.
hope this will help you.
Avuya MxoliRank #7,940 · 231 reputationPosted Jan 16, 2014, 10:39 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 16, 2014, 10:59 PM EST
can you please share your json data format. how it look?
Avuya MxoliRank #7,940 · 231 reputationPosted Jan 16, 2014, 11:02 PM EST
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 16, 2014, 11:33 PM EST
I am not able to find attachment.
Can you please share json string like
string a = = "{\"Id\":\"1\",\"Name\":\"Jignesh\"}"
Avuya MxoliRank #7,940 · 231 reputationPosted Jan 16, 2014, 11:56 PM EST
[{"Data":[{"from":{"name":"someone","id":"},"message":"something","created_time":"some date"},{"from":{"name":"someone","id":"},"message":"something","created_time":"some date"} and so on and so on...