{"ScriptPreparationCode":"var obj = {\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\nvar obj2 = null;","TestCases":[{"Name":"Json parse-stringify","Code":"var obj2 = JSON.parse(JSON.stringify(obj));","IsDeferred":false},{"Name":"own one","Code":"var obj2 = deepCopyData(obj);\r\n\r\nfunction deepCopyData(data) {\r\n let node;\r\n if (Array.isArray(data)) {\r\n node = data.length \u003E 0 ? data.slice(0) : [];\r\n node.forEach((e, i) =\u003E {\r\n if ((typeof e === \u0027object\u0027) || (Array.isArray(e) \u0026\u0026 e.length \u003E 0)) {\r\n node[i] = deepCopyData(e);\r\n }\r\n });\r\n } else if (data \u0026\u0026 typeof data === \u0027object\u0027) {\r\n node = Object.assign({}, data);\r\n Object.keys(node).forEach((key) =\u003E {\r\n if ((typeof node[key] === \u0027object\u0027) || (Array.isArray(node[key]) \u0026\u0026 node[key].length \u003E 0)) {\r\n node[key] = deepCopyData(node[key]);\r\n }\r\n });\r\n } else {\r\n node = data;\r\n }\r\n return node;\r\n}\r\n","IsDeferred":false}]}