-1
我正在編寫一個腳本,通過腳本將數據從twitter api下載到Google表格中。Google腳本解析JSON - 以下路徑是什麼?
從Twitter JSON文件具有奇怪的路徑,根據路徑分析器,得到的名稱,它是:[0] .trends [k]的.NAME
一切似乎是從工作開它試圖解析數據的最後一步:Trending.getRange(1,1,1,1).setValue(response_json.[0].trends[0].name);
我會得到以下錯誤消息:之後缺少名稱。運營商。 (第38行,文件「代碼」)
任何人有任何想法我可以解析這個?
的JSON文件如下:
[
{
"trends": [
{
"name": "#MakeLifeBetterIn3Words",
"query": "%23MakeLifeBetterIn3Words",
"url": "http://twitter.com/search?q=%23MakeLifeBetterIn3Words",
"promoted_content": null
},
{
"name": "#ThingsJesusNeverSaid",
"query": "%23ThingsJesusNeverSaid",
"url": "http://twitter.com/search?q=%23ThingsJesusNeverSaid",
"promoted_content": null
},
{
"name": "#askjack",
"query": "%23askjack",
"url": "http://twitter.com/search?q=%23askjack",
"promoted_content": null
},
{
"name": "#charitytuesday",
"query": "%23charitytuesday",
"url": "http://twitter.com/search?q=%23charitytuesday",
"promoted_content": null
},
{
"name": "#TravelTuesday",
"query": "%23TravelTuesday",
"url": "http://twitter.com/search?q=%23TravelTuesday",
"promoted_content": null
},
{
"name": "Flight of the Conchords",
"query": "%22Flight+of+the+Conchords%22",
"url": "http://twitter.com/search?q=%22Flight+of+the+Conchords%22",
"promoted_content": null
},
{
"name": "Battle of Britain",
"query": "%22Battle+of+Britain%22",
"url": "http://twitter.com/search?q=%22Battle+of+Britain%22",
"promoted_content": null
},
{
"name": "Carol Kirkwood",
"query": "%22Carol+Kirkwood%22",
"url": "http://twitter.com/search?q=%22Carol+Kirkwood%22",
"promoted_content": null
},
{
"name": "Longannet",
"query": "Longannet",
"url": "http://twitter.com/search?q=Longannet",
"promoted_content": null
},
{
"name": "Chris Rogers",
"query": "%22Chris+Rogers%22",
"url": "http://twitter.com/search?q=%22Chris+Rogers%22",
"promoted_content": null
}
],
"as_of": "2015-08-18T11:16:11Z",
"created_at": "2015-08-18T11:11:13Z",
"locations": [
{
"name": "London",
"woeid": 44418
}
]
}
]
謝謝你幫助完全新手! :) – turtlepower