Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/424.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在Google工作表中读取JSON数据_Javascript_Json_Google Sheets - Fatal编程技术网

Javascript 在Google工作表中读取JSON数据

Javascript 在Google工作表中读取JSON数据,javascript,json,google-sheets,Javascript,Json,Google Sheets,我正在尝试将JSON数据从IEXAPI导入Google Sheets,并发现以下功能: 但是,当我在Google Sheets中调用该函数时,我得到一个错误节点不可用: =IMPORTJSON("https://cloud.iexapis.com/stable/tops?token=MY_API_KEY&symbols=aapl", "symbol") 我不明白怎么回事,因为symbol是JSON中的根节点。有人能解释一下吗?您的对象被包装在一个数组中 json=json[0][pat

我正在尝试将JSON数据从IEXAPI导入Google Sheets,并发现以下功能:

但是,当我在Google Sheets中调用该函数时,我得到一个错误
节点不可用

=IMPORTJSON("https://cloud.iexapis.com/stable/tops?token=MY_API_KEY&symbols=aapl", "symbol")

我不明白怎么回事,因为
symbol
是JSON中的根节点。有人能解释一下吗?

您的对象被包装在一个数组中

json=json[0][patharray[i]];
    [{
    "symbol":"AAPL",
    "sector":"electronictechnology",
    "securityType":"cs",
    "bidPrice":0,
    "bidSize":0,
    "askPrice":0,
    "askSize":0,
    "lastUpdated":1587067200000,
    "lastSalePrice":286.48,
    "lastSaleSize":100,
    "lastSaleTime":1587067199848,
    "volume":357754
}]
=IMPORTJSON("https://cloud.iexapis.com/stable/tops?token=MY_API_KEY&symbols=aapl", "symbol")