cancel
Showing results for 
Search instead for 
Did you mean: 

How to prevent json model cross reference

former_member602416
Participant
0 Kudos

Hi,

I have created one json model A which has same structure as another global json model B.

For ex Json Model B =

{ "test" : [

"tester" :{}

"tester" : {}]}

Json Model A =

{"tester" : {}}

I have written a logic that when I have some value on my dialog Input screen then I collect values in model A and then after validation push A to B, which add another tester entry to global model B. It all looks good when first tester is added.

Problem comes when dialog is open 2nd time to add another tester, when new values assigned to model A, model B existing values also gets updated as model A is cross referencing to model B after 1st assignment. Can someone please advice how can I prevent this referencing so I can use model A and B as local and global parameters. I need to add multiple values to model B by appending values collected in model A.

Accepted Solutions (1)

Accepted Solutions (1)

junwu
Active Contributor
0 Kudos

var forBObject=JSON.parse(JSON.stringify(OBJECTYOUPLANTOPUSHTOB))

//push forBObject to your B model

Answers (0)