tags:

views:

109

answers:

1

Hi,

My sample JSON string is as below:

{"8776337":{"text":"Test Message","status":"d","created_time":"1244475327","reply_number":"447624800500","completed_time":"1244475373","credits_cost":"0.4"}}

"8776337" is dynamic key returned by some APIs. I want to get this key value using LINQ to JSON query.

How can I get this key value using LINQ to JSON?

A: 

I know how to get this value with javascript:

function test()
{
var p = {"8776337":{"text":"Test Message","status":"d","created_time":"1244475327","reply_number":"447624800500","completed_time":"1244475373","credits_cost":"0.4"}};
  for (var key in p) {
      if (p.hasOwnProperty(key)) {
        alert(key);
      }
    }
}

then it would be easy to send it to the server side!

Tom