Get specific data from QR code when scan

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…

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

What you have listed is a valid JSON object. If you get the string representation of the data, interpolate it as an object (JSON.parse), you can then access the attribute of that object (myobject["User ID"])

Hi @wawane7256, you mean you want to scan such codes from within your application? You might need a dedicated library for this, jQuery has no such capabilities. I think the easiest way though would be to just generate a QR code with a link to your site and the user ID added as a query parameter, for instance:


Then you can get the user ID as provided with the QR code like so:

const params = new URLSearchParams(
const userId = params.get('user_id')

console.log(userId) // ABC123

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.