I am getting data from a JSON file and want to display some data individually in a textbox. I am using (VBA-JSON v2.3.1 JsonConverter). VBA-Json on Github). VBA-Json in Github
我正在从JSON文件中获取数据,并希望在文本框中单独显示一些数据。我正在使用(VBA-JSON v2.3.1 JsonConverter)。VBA-Json on Github)。Github中的VBA-Json
Here is Output :
以下是输出:
{
"status": "OK",
"code": "OK",
"message": "Ok",
"data": {
"user": {
"id": 5883,
"username": "Demo",
"name": "Niki Jackson",
"email": "[email protected]",
"mobile": "9325547989",
"certificate_id": "122876",
"address": "Sunshine Bvl",
"company": "Light Co",
"expire": "0001-01-01T00:00:00Z",
"status": "active"
}
}
}
I use this code but not work:
我使用以下代码,但不工作:
Dim Parsed As Object
Set Parsed = JsonConverter.ParseJson(JSONS)
text1.text = Parsed("data")("user")(1)("name")
text2.text = Parsed("data")("user")(1)("mobile")
How can I Parse data from Json?
Please, your codes is from the JsonConverter file, not the json file .
Thank you in advance
我如何解析来自Json的数据?请注意,您的代码来自JsonConverter文件,而不是json文件。先谢谢你
更多回答
For future readers, what did "does not work" mean? Did you get an error message? Something else?
对于未来的读者来说,“不起作用”是什么意思?您收到错误消息了吗?还有别的事吗?
优秀答案推荐
I found the answer, I'll leave it here so that maybe the problem of others can be solved.
我找到了答案,我会把它留在这里,这样也许别人的问题就可以解决了。
Dim Parsed As Object
Set Parsed = JsonConverter.ParseJson(JSONS)
text1.text = Parsed.Item("data").Item("user").Item("name")
text2.text = Parsed.Item("data").Item("user").Item("mobile")
更多回答
我是一名优秀的程序员,十分优秀!