2 回答
TA贡献1829条经验 获得超13个赞
您可以使用解构赋值
let obj = {"$id":"1","getEmailBasicData":[{"$id":"2","notificationId":23,"subject":"finaltest","message":"<p>thisisbody</p>\n","sendStatus":-1,"lastSendTime":null},{"$id":"3","notificationId":24,"subject":"finalsubject","message":"<p>finalbody</p>\n","sendStatus":-1,"lastSendTime":null},{"$id":"12","notificationId":33,"subject":"FinalTest","message":"<p>Finalbody</p>\n","sendStatus":-1,"lastSendTime":null}],"getEmailParticipantData":[{"$id":"13","id":55,"notificationId":23,"employeeId":-1,"name":"MdRashedulIslam","emailAddress":"rashed.cse08@gmail.com","contactNo":null},{"$id":"14","id":56,"notificationId":23,"employeeId":-1,"name":"Akash","emailAddress":"akash@ravensystemstld.com","contactNo":null}],"getEmailDocumentData":[{"$id":"36","id":40,"notificationId":23,"docId":1,"attachmentLocation":"1_1_50474603_2287746231437248_8529393497499762688_n.jpg"},{"$id":"46","id":50,"notificationId":33,"docId":1,"attachmentLocation":"1_1_50474603_2287746231437248_8529393497499762688_n.jpg"}]}
const {getEmailBasicData,getEmailDocumentData,getEmailParticipantData} = obj
console.log(getEmailBasicData,getEmailDocumentData,getEmailParticipantData)
TA贡献1815条经验 获得超10个赞
使用运算符访问.
var a={
"$id": "1",
"getEmailBasicData": [
{
"$id": "2",
"notificationId": 23,
"subject": "final test",
"message": "<p>this is body</p>\n",
"sendStatus": -1,
"lastSendTime": null
},
{
"$id": "3",
"notificationId": 24,
"subject": "final subject",
"message": "<p>final body</p>\n",
"sendStatus": -1,
"lastSendTime": null
},
{
"$id": "12",
"notificationId": 33,
"subject": "Final Test",
"message": "<p>Final body</p>\n",
"sendStatus": -1,
"lastSendTime": null
}
],
"getEmailParticipantData": [
{
"$id": "13",
"id": 55,
"notificationId": 23,
"employeeId": -1,
"name": "Md Rashedul Islam",
"emailAddress": "rashed.cse08@gmail.com",
"contactNo": null
},
{
"$id": "14",
"id": 56,
"notificationId": 23,
"employeeId": -1,
"name": "Akash",
"emailAddress": "akash@ravensystemstld.com",
"contactNo": null
} ],
"getEmailDocumentData": [
{
"$id": "36",
"id": 40,
"notificationId": 23,
"docId": 1,
"attachmentLocation": "1_1_50474603_2287746231437248_8529393497499762688_n.jpg"
},
{
"$id": "46",
"id": 50,
"notificationId": 33,
"docId": 1,
"attachmentLocation":
"1_1_50474603_2287746231437248_8529393497499762688_n.jpg"
}
]
}
var basic=a.getEmailBasicData;
var doc=a.getEmailDocumentData;
var participants=a.getEmailParticipantData;
console.log(basic);
console.log(doc);
console.log(participants);
- 2 回答
- 0 关注
- 264 浏览
添加回答
举报