javascriptjqueryqr-codebarcode-scannerscanning

Scan QR code and get particular key from an object


I am storing the data in a QR code with the below structure, I am facing the issue and want to achieve the output when I scan the QR it will only catch the User ID value as ABC123 only through jQuery and pressing the QR scanner machine button. Is this possible? Please help me with How I code…

QR Code Priview

{
  "User ID": "ABC123",
  "First Name": "John",
  "Last Name": "Cartor"
}

Solution

  •    let myJSON = $.parseJSON('{ "user_id": "ABC123", "first_name": "John", "last_name": "Cartor" }');
       console.log(myJSON.user_id);
    

    Notice I've renamed the keys here so it's easier to get back data.