からのオブジェクトにアクセスできません:は、私はJSONオブジェクトを次しまったJSON
[{"model": "pricing.cashflow", "pk": 1, "fields": {"value": 4.0, "date": "2016-09-09"}}, {"model": "pricing.cashflow", "pk": 2, "fields": {"value": 3.0, "date": "2016-09-01"}}, {"model": "pricing.cashflow", "pk": 3, "fields": {"value": 3.0, "date": "2016-09-01"}}, {"model": "pricing.cashflow", "pk": 4, "fields": {"value": 3.0, "date": "2016-09-01"}}, {"model": "pricing.cashflow", "pk": 5, "fields": {"value": 3.0, "date": "2016-09-01"}}, {"model": "pricing.cashflow", "pk": 6, "fields": {"value": 5.0, "date": "2016-09-07"}}, {"model": "pricing.cashflow", "pk": 7, "fields": {"value": 3.0, "date": "2016-09-28"}}, {"model": "pricing.cashflow", "pk": 8, "fields": {"value": 3.0, "date": "2016-09-22"}}, {"model": "pricing.cashflow", "pk": 9, "fields": {"value": 5.0, "date": "2016-09-16"}}, {"model": "pricing.cashflow", "pk": 10, "fields": {"value": 5.0, "date": "2016-09-16"}}, {"model": "pricing.cashflow", "pk": 11, "fields": {"value": 4.0, "date": "2016-09-08"}}, {"model": "pricing.cashflow", "pk": 12, "fields": {"value": 8.0, "date": "2016-09-22"}}, {"model": "pricing.cashflow", "pk": 13, "fields": {"value": 3.0, "date": "2016-09-22"}}, {"model": "pricing.cashflow", "pk": 14, "fields": {"value": 5.0, "date": "2016-09-01"}}, {"model": "pricing.cashflow", "pk": 15, "fields": {"value": 8.0, "date": "2016-09-01"}}, {"model": "pricing.cashflow", "pk": 16, "fields": {"value": 4.0, "date": "2016-09-08"}}, {"model": "pricing.cashflow", "pk": 17, "fields": {"value": 5.0, "date": "2016-09-09"}}, {"model": "pricing.cashflow", "pk": 18, "fields": {"value": 5.0, "date": "2016-09-09"}}, {"model": "pricing.cashflow", "pk": 19, "fields": {"value": 5.0, "date": "2016-09-09"}}, {"model": "pricing.cashflow", "pk": 20, "fields": {"value": 3.0, "date": "2016-09-16"}}, {"model": "pricing.cashflow", "pk": 21, "fields": {"value": 3.0, "date": "2016-09-16"}}, {"model": "pricing.cashflow", "pk": 22, "fields": {"value": 3.0, "date": "2016-09-16"}}, {"model": "pricing.cashflow", "pk": 23, "fields": {"value": 3.0, "date": "2016-09-16"}}, {"model": "pricing.cashflow", "pk": 24, "fields": {"value": 3.0, "date": "2016-09-16"}}]
私はフィールド「値」と「日付」を取得したいです。私は、JSONオブジェクトとしてデシリアライズ、JavaScriptで
$http.get("/getcashflow/")
.success(function(data) {
for(var cf in data){
alert(cf.fields.value.data*);
}
});
};
。 data。*は返された元の配列を参照します。 cfは配列の単一のオブジェクトを参照します – mhodges
@mhodgesは今のように?元の質問を参照してください。 – belgiums
それは読む必要があります:alert(cf.fields.value) – mhodges