-2

嗨,我正在与 Kendo 合作并尝试读取从 Json 解析的数据。

这是我的 Json 结果(javascript 对象)

{
"Success":true,"Model":

[{"Attributes":{"Keys":[],"Count":0,"CssStyle":{"Keys":[],"Count":0,"Value":null}},"Enabled":true,"Selected":false,"Text":"Sunday","Value":"1"},

{"Attributes":{"Keys":[],"Count":0,"CssStyle":{"Keys":[],"Count":0,"Value":null}},"Enabled":true,"Selected":false,"Text":"Monday","Value":"2"},

{"Attributes":{"Keys":[],"Count":0,"CssStyle":{"Keys":[],"Count":0,"Value":null}},"Enabled":true,"Selected":false,"Text":"TuesDay","Value":"3"}]}

现在我想要的是从上面的对象中列出 Text 和 Value。无论是 javascript 还是 jquery 都可以。通过使用任何循环,我们可以获得这些值吗?

4

1 回答 1

2
$.each(jsonObj.Model,function(){
   console.log(this.Text + " - " + this.Value)
});

演示-----> http://jsfiddle.net/GU6g8/

于 2013-06-19T09:30:53.193 回答