Ad Widget

Collapse

Javascript modify object to insert key

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jason
    Senior Member
    • Nov 2007
    • 430

    #1

    Javascript modify object to insert key

    I'm trying to interrogate a Ruckus smartzone controller via the API from zabbix. I've got the calls working and have a list of the zones. The data returned is of format similar to below after JSON.stringify

    [{"id":"long-zone-id","name":"Zone1"},{"id":"long-zone-id2","name":"Zone2"}]

    I'd like to loop through this structure inserting an extra item into each section. So far I've tried for in loop and it's not done any changes. I've tried forEach with same result. How's the best way to achieve this?
  • Jason
    Senior Member
    • Nov 2007
    • 430

    #2
    I've finally figured it out. I had to define the variable I wanted to as an object and then push the values to it. Now my discovery with the extra inserted object is working fine

    Comment

    Working...