I have couple of json String which I got using JSON.stringify
and now have to combine all jsonString in one single json.
below are the 3 json strings I have
json 1= '{
"authSeqNo" : 14,
"flagNewEdit": "EDIT",
"groupId": "AD0009",
"groupName": "IT-Updated",
"roleId": "Admin-Updated",
"recordStatus": "A"
}'
json 2=
{"userList": [
{
"userId": "x",
"email": "x@gamail.com",
"isDelete" : "TRUE"
},
{
"userId": "y",
"email": "y@gmail.com",
"isDelete" : "FALSE"
}
]}
json 3=
{"authMenuList": [
{
"menuId" : "ATHMGT",
"viewFlag": "1",
"createFlag": "1",
"editFlag": "0",
"deleteFlag": "1",
"creditnoteFlag": "0",
"cancelFlag": "1"
}]}
Now have to join all these 3 to 1, I have tried the below way
var completeDetails = json1.concat(json2);
completeDetails=completeDetails.concat(json3);
but it's not giving the desired output.
my expected result should be like below
{
"authSeqNo" : 14,
"flagNewEdit": "EDIT",
"groupId": "AD0009",
"groupName": "IT-Updated",
"roleId": "Admin-Updated",
"recordStatus": "A",
"userList": [
{
"userId": "x",
"email": "x@gmail.com",
"isDelete" : "TRUE"
},
{
"userId": "y",
"email": "y@gmail.com",
"isDelete" : "FALSE"
}
],
"authMenuList": [
{
"menuId" : "ATHMGT",
"viewFlag": "1",
"createFlag": "1",
"editFlag": "0",
"deleteFlag": "1",
"creditnoteFlag": "0",
"cancelFlag": "1"
}]
}
but I getting output is
{
"authSeqNo": "0",
"flagNewEdit": "NEW",
"groupId": "TEST",
"groupName": "GroupN",
"roleId": "Administrator",
"recordStatus": ""
} {
"userList": "[{"
userId ":"
x ","
email ":"
x @v.com ","
delete ":"
"}, {
"userId": "asdkl",
"email": "x@sd.com",
"delete": ""
}]
"} {
"authMenuList[{"
menuId ":"
ATHMGT ","
viewFlag ":"
1 ","
createFlag ":"
1 ","
editFlag ":"
0 ","
deleteFlag ":"
1 ","
creditnoteFlag ":"
0 ","
cancelFlag ":"
1 "}]}
I am new to javascript and learning it. Please help me to solve this.