我想从JSON数据中获取键和值,如下所示。
{
"data": {
"listCard": {
"cards": [
{
"id": "2",
"title": "벗꽃볼사람",
"content": "하이",
"createdAt": "2019-04-17T16:06:31.962772+00:00",
"creator": {
"id": "2",
"name": "운영자"
}
},
{
"id": "1",
"title": "벗꽃볼사람",
"content": "하이",
"createdAt": "2019-04-17T16:06:14.789277+00:00",
"creator": {
"id": "2",
"name": "운영자"
}
}
]
}
}
}
我使用下面显示的console.log(data.listCard)
{cards: Array(2), __typename: "ListCardResponse"}
cards: Array(2)
0: {id: "2", createdAt: "2019-04-17T16:06:31.962772+00:00", updatedAt: "2019-04-17T16:06:31.962820+00:00", title: "벗꽃볼사람", content: "하이", …}
1: {id: "1", createdAt: "2019-04-17T16:06:14.789277+00:00", updatedAt: "2019-04-17T16:06:14.789315+00:00", title: "벗꽃볼사람", content: "하이", …}
length: 2
__proto__: Array(0)
__typename: "ListCardResponse"
__proto__: Object
但是我使用console.log(data.listCard.cards)它显示卡没有定义。
最后我想使用data.listCard.cards.map。你可以帮帮我吗?
相关分类