2

我对此很陌生,答案可能很简单,但请帮忙。

我从查询中返回以下内容,这是jsonParse结果

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

如何Id在最后提取到变量 when 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 回答