0
我正在使用VB-JSON解析器從API獲取數據並將數據保存在MS訪問表中。使用JSOn獲取MS Access中節點的值
我無法弄清楚如何訪問-KLj9kXnKd-9txfyIqM8
和-KLjJoT7gXCMq_jHx2_z
。
我有表結構如下,並希望保存數據如下所示。
|ServerID |Name |Mobile
|-KLj9kXnKd-9txfyIqM8 |Adarsh |9987
|-KLjJoT7gXCMq_jHx2_z |Manas |022
JSON
{
"-KLj9kXnKd-9txfyIqM8": {
"personmobile": "9987",
"personname": "Adarsh"
},
"-KLjJoT7gXCMq_jHx2_z": {
"personmobile": "022",
"personname": "Manas"
}
}
VBA
Public Sub GetPerson()
'I have code here which gets the json as above from api.
Dim egTran As String
If reader.Status = 200 Then
Set db = CurrentDb
Set rs = db.OpenRecordset("tblPerson", dbOpenDynaset, dbSeeChanges)
egTran = "[" & reader.responseText & "]"
Set coll = Json.parse(egTran)
For Each contact In coll
rs.AddNew
rs!Name = contact.Item("personname")
rs!Mobile = contact.Item("personmobile")
rs!ServerID = contact.Item("??????")
我該怎麼寫
??????
rs.Update
Next
End If
End Sub
我也打開使用任何其他解析器。該API是基於Firebase Database