2009-11-17 70 views
1

我的樣品JSON字符串是如下:如何獲得鍵值

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

「8776337」是由一些API返回的動態密鑰。我想要使​​用LINQ to JSON查詢來獲取此鍵值。

如何使用LINQ to JSON獲取此鍵值?

回答

0

我知道如何使用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); 
     } 
    } 
} 

那麼這將是很容易將它發送到服務器端!