2

私はこれで非常に新しく、答えはおそらく非常に簡単ですが、助けてください。

クエリから次の結果が返されます。これはjsonParse結果の1つです。

{"totalSize":1,
"done":true,
"records":
    [{"attributes": 
    {
        "type":"Account",
        "url":"/services/data/v21.0/sobjects/Account/001C0000012Z8Y5IAK"
    },
    "Id":"001C0000012Z8Y5IAK"
    }] 
}

Idの場合、最後にを変数に抽出するにはどうすればよいtotalSize = 1ですか?

4

1 に答える 1

1

objectName.records[0].Idがそのトリックを実行します。レコードのインデックスを適切にインクリメントします。

サンプル -

var sforceResponse = {"totalSize":1,"done":true,"records":[{"attributes":{"type":"Account","url":"/services/data/v21.0/sobjects/Account/001C0000012Z8Y5IAK"},"Id":"001C0000012Z8Y5IAK"}]}

sforceResponse.records[0].Id //this variable contains the Id. 
于 2012-11-16T19:54:31.553 に答える