![]() |
1
0
使用Tim Hall的JSON工具;( https://github.com/VBA-tools/VBA-JSON ) Sub TestJSON() Dim data As Dictionary, email As Dictionary, strJSON As String Set data = New Dictionary Set email = New Dictionary With data .Add "value", "[email protected]" .Add "type", "work" .Add "primary", True End With email.Add "emails", data strJSON = JsonConverter.ConvertToJson(ByVal email) MsgBox strJSON End Sub 结果是:; {"emails":{"value":"[email protected]","type":"work","primary":true}} |
![]() |
2
0
或者,如果你需要添加一系列电子邮件,那么使用这样的东西。 显然,您可能需要修改将字典数据添加到集合的方法,因为这只是一个显示机制的示例。 Sub TestJSON2() Dim data As Dictionary, email As Collection, JSON_data As Dictionary, strJSON As String Set email = New Collection Set data = New Dictionary With data .Add "value", "[email protected]" .Add "type", "work" .Add "primary", True End With email.Add data Set data = New Dictionary With data .Add "value", "[email protected]" .Add "type", "Home" .Add "primary", False End With email.Add data Set data = New Dictionary With data .Add "value", "[email protected]" .Add "type", "work" .Add "primary", True End With email.Add data Set JSON_data = New Dictionary JSON_data.Add "emails", email strJSON = JsonConverter.ConvertToJson(ByVal JSON_data, 2) MsgBox strJSON End Sub 结果如下:; {"emails":[{"value":"[email protected]","type":"work","primary":true},{"value":"[email protected]","type":"Home","primary":false},{"value":"[email protected]","type":"work","primary":true}]} |
![]() |
blogger13 · 视频租赁店数据库的规范化 5 月前 |
![]() |
Pepito · 从一个选择中使用别名,以便在另一个选择中将其使用 5 月前 |
![]() |
Shiela · 日期/时间格式VBA访问查询 6 月前 |
|
Chuck S · Microsoft关于IIf声明或更好解决方案的问题 10 月前 |
![]() |
Tim O · 从MS Access 2016中的字符串字段中间提取数值 11 月前 |