【问题标题】:PARSE JSON WITH VBA使用 VBA 解析 JSON
【发布时间】:2020-07-11 14:42:07
【问题描述】:

我需要一些帮助来解析这个 JSON 结果。

这个想法是从rates 获取日期值和数字。

例如:

2018-01-03 : 9.825

2018-01-05 : 9.8318

我在我的代码中使用 JsonConverter。

{"rates":
{
    "2018-01-03":{"SEK":9.825},
    "2018-01-05":{"SEK":9.8318},
    "2018-01-02":{"SEK":9.8283},
    "2018-01-04":{"SEK":9.822}
},
"start_at":"2018-01-01",
"base":"EUR",
"end_at":"2018-01-05"}

感谢您的反馈。

【问题讨论】:

标签: json vba ms-access


【解决方案1】:

试试这个:

    Dim parsedJSON As Dictionary
    Set parsedJSON = JsonConverter.ParseJson(yourJsonString)

    Dim rateKey As Variant
    For Each rateKey In parsedJSON("rates")
        Dim rate As Dictionary
        Set rate = parsedJSON("rates")(rateKey)
        Debug.Print rateKey, rate.Items(0)
    Next rateKey

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-10-08
    • 2018-06-13
    • 1970-01-01
    • 1970-01-01
    • 2021-12-29
    • 1970-01-01
    相关资源
    最近更新 更多