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.

  • 1
    What have you tried? Being that JSON stands for JavaScript Object Notation, and the controller for LWC is, in fact, JavaScript...there shouldn't be any parsing required. Just use it as you would any other JavaScript object... – Derek F Jun 16 at 14:12
  • I tried JSON.stringify(this.selectedRecord) - which is giving me the value of ID & Name {"Id":"01t5C000002xxx","Name":"xxxES"}. I want the value of the Id so that i can save this record as a look up. – Sunil Jun 16 at 14:49

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


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.