Prats Prats - 8 months ago 31
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



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.