Hi
I have this array:
[
{
"role":{
"code":"LA",
"name":"Local administrator",
"id":1
}
},
{
"role":{
"code":"SA",
"name":"System administrator",
"id":2
}
}
]
and also the scopes array
"scopes":[
{
"type":{
"id":1,
"code":"COR",
"name":"Description 1"
},
"ids":[
1,
2,
3
],
"cascade":false
}
],"scopes":[
{
"type":{
"id":2,
"code":"TES",
"name":"Test"
},
"ids":[
55
],
"cascade":true
},
{
"type":{
"id":1,
"code":"COR",
"name":"Description 1"
},
"ids":[
77,
88
],
"cascade":true
}
]
and an array of the the RoleId:
"roleId":1, "roleId":2
How can I combine all those to end up to the following JSON structure?
[
{
"role":{
"code":"LA",
"name":"Local administrator",
"id":1
},
"scopes":[
{
"type":{
"id":1,
"code":"COR",
"name":"Description 1"
},
"ids":[
1,
2,
3
],
"cascade":false
}
],
"roleId":1
},
{
"role":{
"code":"SA",
"name":"System administrator",
"id":2
},
"scopes":[
{
"type":{
"id":2,
"code":"TES",
"name":"Test"
},
"ids":[
55
],
"cascade":true
},
{
"type":{
"id":1,
"code":"COR",
"name":"Description 1"
},
"ids":[
77,
88
],
"cascade":true
}
],
"roleId":2
}
]
What I have tried:
I tried with array.push but it's not working properly