javascript - How to put json inner object into another same type of json object -


i have json object below.

var obj = {     "_id": "mand-configurations",     "server-host": "0.0.0.0",     "server-port": [1890, 1770, 2070],     "server-rest-api-timeout-in-millis": 3020,     "server-started": "server started successfuly",     "stopped-snmp": "server shutdown",     "connection-failed": "connection pgw-server failed",     "request-time-out": "pgw-server request time out",     "notify-connection-failed-snmp": "connection notification-server failed",     "subscription": {         "control-data": [             "app",             "sp"         ],         "callback-url": "http://core.sdp:19980/notify",         "post-notification": true     },     "charging-start-time": "01:00",     "charging-schedulers": [         {             "scheduler-name": "fifteen",             "charging-scheduler-type": "fifteen-days",             "initial-delay": 10000,             "batch-execution": 10000,             "batch-execution-size": 100,             "charging-schedules": [                 {                     "charging-model-name": "fixed-fifteen"                 }             ]         }     ] } 

and here copy , change values.

var cpyobj = obj;  cpyobj["charging-schedulers"][0]["scheduler-name"] = "some value" 

then need update previous obj new cpyobj's values. how can thing.

making changes in "cpyobj" change "obj" because no copying performed. yeah believe don't need anything.


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

angularjs - ng-repeat duplicating items after page reload -