Arrays 为什么在将JSON解析为Excel时收到错误10001

Arrays 为什么在将JSON解析为Excel时收到错误10001,arrays,json,excel,vba,web-scraping,Arrays,Json,Excel,Vba,Web Scraping,我有一个代码,通过解析JSON获得更新的股票价格。我基本上做到了以下几点: 1-下载了VBA JSON最新版本。 2-提取它,在excel(Alt+F11)中打开VBA代码编辑器并导入 图书馆。 3-添加对Microsoft脚本运行时的引用。(工具>参考资料> 选择) 出于某种原因,我不断得到以下错误: 错误:Raise 10001,“JSONConverter”,json_ParseErrorMessage(JsonString, json_索引,“应为“{”或“[”) responsetex

我有一个代码,通过解析JSON获得更新的股票价格。我基本上做到了以下几点: 1-下载了VBA JSON最新版本。 2-提取它,在excel(Alt+F11)中打开VBA代码编辑器并导入 图书馆。 3-添加对Microsoft脚本运行时的引用。(工具>参考资料> 选择)

出于某种原因,我不断得到以下错误:

错误:Raise 10001,“JSONConverter”,json_ParseErrorMessage(JsonString, json_索引,“应为“{”或“[”)


responsetext的示例是什么?您有一个股票符号列表,起始范围为“a4”及以下。代码将检索股票的“LastPrice”,并将其粘贴到起始单元格“b4”上我理解代码的作用,但你需要提供失败的JSON字符串。最有可能的问题是文本字符串而不是代码。嗨-如果我理解正确,你需要moduel中的JSONConverter代码?它太大了,不允许我粘贴。我必须在每行代码中放置4个空格。不我需要输出:
myrequest.ResponseText
这是什么?您试图解析的JSON字符串是什么?根据消息,它缺少一些内容。这是问题所在。不是代码。您试图解析的内容无效。ResponseText的示例是什么?您有一个从“a4”开始的股票符号列表代码将检索股票的“LastPrice”,并将其粘贴到起始单元格“b4”中我理解代码的作用,但你需要提供失败的JSON字符串。最有可能的问题是文本字符串而不是代码。嗨-如果我理解正确,你需要moduel中的JSONConverter代码?它太大了,不允许我粘贴。我必须在每行代码中放置4个空格。不我需要输出:
myrequest.ResponseText
这是什么?您试图解析的JSON字符串是什么?根据消息,它缺少一些内容。这是问题所在。不是代码。您试图解析的内容无效。
Sub getData()

    Application.DisplayAlerts = False
    Application.ScreenUpdating = False

    Dim wb As Workbook
    Dim ws As Worksheet
    Dim rng As Range
    Dim symbol As Variant
    Dim n As Integer
    Dim lastrow As Long
    Dim myrequest As Variant
    Dim i As Integer

    Set wb = ActiveWorkbook
    Set ws = Sheets("Sheet1")
    ws.Activate

    'Last row find
    lastrow = ws.Cells(Rows.Count, "A").End(xlUp).Row

    Set rng = ws.Range("A4:A" & lastrow)

    'Clear Prior Prices
    ws.Range("B4:B" & lastrow).ClearContents

    n = 4
    'Get Symbols list
    For Each symbol In rng

        Set myrequest = CreateObject("WinHttp.WinHttpRequest.5.1")
        myrequest.Open "Get", "https://api.iextrading.com/1.0/stock/" & symbol &
        "/quote"
        'myrequest.Open "Get", "https://www.bloomberg.com/markets/api/bulk-time-
        series/price/" & symbol & "%3AUS?timeFrame=1_DAY"
        myrequest.Send

        Debug.Print myrequest.ResponseText

        Dim Json As Object
        Set Json = JsonConverter.ParseJson(myrequest.ResponseText)
        MsgBox (myrequest.ResponseText)
        i = Json(1)("latestPrice")
        ws.Range(Cells(n, 2), Cells(n, 2)) = i
        n = n + 1

    Next symbol

    ws.Columns("B").AutoFit
    MsgBox ("Data is downloaded.")

    ws.Range("B4:B" & lastrow).HorizontalAlignment = xlGeneral
    ws.Range("B4:B" & lastrow).NumberFormat = "$#,##0.00"

    Application.DisplayAlerts = True
    Application.ScreenUpdating = True

End Sub