{"ScriptPreparationCode":"var MyObject = {\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:\u0022500 mg\u0022\r\n }],\r\n \u0022associatedDrug#2\u0022:[{\r\n \u0022name\u0022:\u0022somethingElse\u0022,\r\n \u0022dose\u0022:\u0022\u0022,\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:\u0022500 mg\u0022\r\n }],\r\n \u0022associatedDrug#2\u0022:[{\r\n \u0022name\u0022:\u0022somethingElse\u0022,\r\n \u0022dose\u0022:\u0022\u0022,\r\n \u0022strength\u0022:\u0022500 mg\u0022\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 myCopy = null;\r\n\r\nfunction recursiveDeepCopy(o) {\r\n var newO,\r\n i;\r\n \r\n if (typeof o !== \u0027object\u0027) {\r\n return o;\r\n }\r\n if (!o) {\r\n return o;\r\n }\r\n \r\n if (\u0027[object Array]\u0027 === Object.prototype.toString.apply(o)) {\r\n newO = [];\r\n for (i = 0; i \u003C o.length; i \u002B= 1) {\r\n newO[i] = recursiveDeepCopy(o[i]);\r\n }\r\n return newO;\r\n }\r\n \r\n newO = {};\r\n for (i in o) {\r\n if (o.hasOwnProperty(i)) {\r\n newO[i] = recursiveDeepCopy(o[i]);\r\n }\r\n }\r\n return newO;\r\n }","TestCases":[{"Name":"Lodash CloneDeep","Code":"myCopy = _.cloneDeep(MyObject);","IsDeferred":false},{"Name":"Json Clone","Code":"myCopy = JSON.parse(JSON.stringify(MyObject));","IsDeferred":false},{"Name":"recursiveDeepCopy","Code":"myCopy = recursiveDeepCopy(MyObject);","IsDeferred":false}]}