Lightning Web Components – How to Parse JSON in LWC

I'm getting a JSON response as follows :-

tthis.selectedRecord {"Id":"01t5C000002xxx","Name":"xxxES"},wanted to know how do i get the value of ID & Name separately.

Best Answer

Based on your comment, it sounds like you already have a native JavaScript object; no parsing is required:

console.log(this.selectedRecord.Id);
console.log(this.selectedRecord.Name);

Make sure you pay attention to the capitalization of the variables; Name is different than name.