{"ScriptPreparationCode":"function deepClone(val) {\r\n if (typeof val !== \u0027object\u0027 || val === null) {\r\n return val;\r\n }\r\n if (Array.isArray(val)) {\r\n return val.map((item) =\u003E deepClone(item));\r\n }\r\n const obj = {};\r\n for (const key in val) {\r\n obj[key] = deepClone(val[key]); \r\n }\r\n return obj;\r\n}\r\n\r\nvar obj1 = {\r\n\u0022problems\u0022: [{\r\n \u0022Diabetes\u0022:[{\r\n \u0022medications\u0022:[{\r\n \u0022medicationsClasses\u0022:[{\r\n \u0022className\u0022:[{\r\n \u0022associatedDrug\u0022:[{\r\n \u0022name\u0022:\u0022asprin\u0022,\r\n \u0022dose\u0022:\u0022\u0022,\r\n \u0022strength\u0022:3232323\r\n }],\r\n \u0022associatedDrug#2\u0022:[{\r\n \u0022name\u0022: 3232323,\r\n \u0022dose\u0022:null,\r\n \u0022strength\u0022:\u0022500 mg\u0022\r\n }]\r\n }],\r\n \u0022className2\u0022:[{\r\n \u0022associatedDrug\u0022:[{\r\n \u0022name\u0022:\u0022asprin\u0022,\r\n \u0022dose\u0022:\u0022\u0022,\r\n \u0022strength\u0022:212132\r\n }],\r\n \u0022associatedDrug#2\u0022:[{\r\n \u0022name\u0022:4343,\r\n \u0022dose\u0022:\u0022fdsafd\u0022,\r\n \u0022strength\u0022:32323232\r\n }]\r\n }]\r\n }]\r\n }],\r\n \u0022labs\u0022:[{\r\n \u0022missing_field\u0022: \u0022missing_value\u0022\r\n }]\r\n }],\r\n \u0022Asthma\u0022:[{}]\r\n}]};\r\n\r\nvar obj2 = null;","TestCases":[{"Name":"JSON parse/stringify","Code":"obj2 = JSON.parse(JSON.stringify(obj1));","IsDeferred":false},{"Name":"deepClone","Code":"obj2 = deepClone(obj1)","IsDeferred":false},{"Name":"Lodash deepClone","Code":"obj2 = _.cloneDeep(obj1);","IsDeferred":false}]}