如何从blow String中提取pathmp3?
[
{
"id":2578774,
"word":"apple",
"addtime":"2013-11-04 21:40:05",
"hits":6796,
"username":"JerrySun",
"sex":"m",
"country":"United States",
"code":"en",
"langname":"English",
"pathmp3":"http:\/\/apifree.forvo.com\/audio\/3l2h333f1p3d1h2a363f2j3b2h2j282e3f373m2b3f2k1g31231n3m3i3l331n2637361i3g393c293j243i3l2c3o341b2p291j2k1n1l1o3m233p2e1g1h2i343m25_2925241j3a1j3f342e232c3k2k212n2i29263p352i3n1t1t",
"pathogg":"http:\/\/apifree.forvo.com\/audio\/28313h382e3j2g3k3k231b311j3k39281l1h1m1g2d1h3m2h3g3k1o2h3n2m273325332l3e331g2n2j2l2k293b3d3k2f3a322k2l1p2521232a232a2l2n1l2p2q3l_2i253a2o1f233626273i3d2e2k243j231j243m2a28371t1t",
"rate":5,
"num_votes":5,
"num_positive_votes":5
}
];
答案 0 :(得分:1)
您可以使用arr [0] .pathmp3
访问此值var arr= [
{
"id":2578774,
"word":"apple",
"addtime":"2013-11-04 21:40:05",
"hits":6796,
"username":"JerrySun",
"sex":"m",
"country":"United States",
"code":"en",
"langname":"English",
"pathmp3":"http:\/\/apifree.forvo.com\/audio\/3l2h333f1p3d1h2a363f2j3b2h2j282e3f373m2b3f2k1g31231n3m3i3l331n2637361i3g393c293j243i3l2c3o341b2p291j2k1n1l1o3m233p2e1g1h2i343m25_2925241j3a1j3f342e232c3k2k212n2i29263p352i3n1t1t",
"pathogg":"http:\/\/apifree.forvo.com\/audio\/28313h382e3j2g3k3k231b311j3k39281l1h1m1g2d1h3m2h3g3k1o2h3n2m273325332l3e331g2n2j2l2k293b3d3k2f3a322k2l1p2521232a232a2l2n1l2p2q3l_2i253a2o1f233626273i3d2e2k243j231j243m2a28371t1t",
"rate":5,
"num_votes":5,
"num_positive_votes":5
}
];
alert(arr[0].pathmp3);
答案 1 :(得分:1)
您的Object
似乎有一个String
实际上是Array
。
只需alert(myString[0].pathmp3);
myString[0]
将访问第一个(也是唯一的)对象,并且附加到其中的.pathmp3
将访问该对象的pathmp3
属性。
工作代码段:
var myString= [
{
"id":2578774,
"word":"apple",
"addtime":"2013-11-04 21:40:05",
"hits":6796,
"username":"JerrySun",
"sex":"m",
"country":"United States",
"code":"en",
"langname":"English",
"pathmp3":"http:\/\/apifree.forvo.com\/audio\/3l2h333f1p3d1h2a363f2j3b2h2j282e3f373m2b3f2k1g31231n3m3i3l331n2637361i3g393c293j243i3l2c3o341b2p291j2k1n1l1o3m233p2e1g1h2i343m25_2925241j3a1j3f342e232c3k2k212n2i29263p352i3n1t1t",
"pathogg":"http:\/\/apifree.forvo.com\/audio\/28313h382e3j2g3k3k231b311j3k39281l1h1m1g2d1h3m2h3g3k1o2h3n2m273325332l3e331g2n2j2l2k293b3d3k2f3a322k2l1p2521232a232a2l2n1l2p2q3l_2i253a2o1f233626273i3d2e2k243j231j243m2a28371t1t",
"rate":5,
"num_votes":5,
"num_positive_votes":5
}
];
alert(myString[0].pathmp3);