I have a Javascript object that looks like this.
ips[ipID] = {}
So I end up with a bunch of ips that need to store information that will look like
ipID { name : 'val', anotherName : 'anotherVal' }
My question is, how do I dynamically add these names and values?
Solution For JSON Object:
By default:
JSON Code:
JSON Result:
If you would like to use the great underscore library (a swiss army knife for js developers), you could use the extend method http://documentcloud.github.com/underscore/#extend.
So for example
Hope this is clear, it would be easier to help if you had a more precise question.
I believe this is the easiest thing to do if your names are dynamic: