I have this json string.
user_json_str =
"
[{
"id": 1,
"lg_name": "foo",
"lg_password": "bar"
},
{
"id": 2,
"lg_name": "user",
"lg_password": "passwd"
}
]
";
I would like to manipulate it such that it becomes a javascript object that looks like this;
user_obj =
{
foo: {
id: 1,
password: 'bar'
},
user: {
id: 2,
password: 'passwd'
}
};
I am using node.js v4.6. I am at a loss how to begin. Some hints as starting points would be helpful.