2013-02-15 51 views
0

JSON我有一個包含這樣JSON數據的調查場:正則表達式爲在MySQL字段

{ 
    "reason": 
    { 
     "0":"first", 
     "1":"second", 
     "other":["on","third"] 
    }, 
    "comment":"fourth" 
} 

我想選擇所述第一,第二,第三和第四在SQL值。

謝謝。

+0

使用'$ result = json_decode($ array,true); print_r($ result);' – 2013-02-15 10:33:12

+0

我想我們誤解了對方。我只想用SQL來做。 – recis 2013-02-15 10:38:36

+0

總是一樣的結構? – 2013-02-15 10:39:19

回答

1
var JSONObject = {"reason":{"0":"first","1":"second","other":["on","third"]},"comment":"fourth"}; 

document.getElementById("first").innerHTML=JSONObject.reason[0]; 

document.getElementById("second").innerHTML= JSONObject.reason[1]; 

document.getElementById("comment").innerHTML= JSONObject.comment[0];