How can I parse through JSON object array in Javascript and access the values? var json = [{"employee": "John", "id":"9

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

How can I parse through JSON object array in Javascript and access the values? var json = [{"employee": "John", "id":"9

Post by answerhappygod »

How can I parse through JSON object array in Javascript and
access the values?
var json = [{"employee": "John", "id":"97"},
{"employee": "Mary", "id": "98"}, {"employee": "Larry", "id":
"99}];
var obj = JSON.parse(json);
console.log(obj.employee);
console.log(obj.id);
I would like to be able to pull values like all employees or all
ids.
But this returns the value as 'undefined'. I need to be able to
access and use the values of the JSON object in my code. How would
I be able to efficiently do this?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply