gpt4 book ai didi

javascript - 在 JavaScript 中访问 JSON 对象(已解析)中的数据

转载 作者:数据小太阳 更新时间:2023-10-29 04:31:32 24 4
gpt4 key购买 nike

我需要从这个 JSON 对象中获取数据“消息”。我怎样才能在 JavaScript 中做到这一点?

要访问我刚刚使用的姓氏:

response[i].user.lastname

但是我怎样才能访问消息呢?

[
{
"user": {
"last_message": {
"message": {
"created_at": "2011-04-16T16:40:56Z",
"updated_at": "2011-04-16T16:40:56Z",
"to": null,
"id": 10,
"user_id": 28,
"message": "This is a message"
}
},
"nickname": "thenicky",
"id": 28,
"lastname": "white",
"firstname": "Sean",
"bio": "A short bio",
"email": "the@email.com"
}
}
]

最佳答案

response[i].user.last_message.message.created_at

这是一个 live demo .

关于javascript - 在 JavaScript 中访问 JSON 对象(已解析)中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5689931/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com