以下是Google脚本的代码:
var request =
UrlFetchApp.fetch('https://api.example.com/v2/directory/myuserid.json?
key=myapikey');
Logger.log(request); // see below
JSON.parse(request);
Logger.log(request); // see below
Logger.log(request["meta"]); // undefined
var meta = "meta";
Logger.log(request.meta); // undefined
当我在解析之前和之后记录请求时,我得到以下内容:
{"meta":{"requests":67,"timestamp":1497800064,"status":200,"message":"Request successful","method_id":1201,"method":{}},"data":{"full_name":"my name","given_name":"given name","last_name":"last name","user_id":"user id","department":"eng","common_names":["first last"],"email_addresses":[],"offices":[],"telephone_numbers":[],"homepage":""}}
这似乎只发生在我使用的这个特定API上。