Prats Prats - 2 years ago 92
Node.js Question

Add a new attribute to existing json object in node.s

I have an object like this

==================records=========={ Id: 5114a3c21203e0d811000088,
userId: 'test',
sUserId: test,
userName: 'test',
url: 'test',
Title: 'test'

I need to add a new field Name : 'test' to the above record, I tried giving records.Name = name, it didn't work.

Helps please


Answer Source

Those finding this problem, OP mentioned in a comment below the original question that the solution for this problem is:

records.set('Name', 'test')

This adds a new attribute called Name having value test.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download