Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

romitkumar's avatar

Access objects from JSON String

I am unable to access JSON string's object after using methods parse/stringify. Every time log the output it shows -

*escapeWhenCastingToString
: 
false
*items
: 
[{cn_assignmentgroup: "JDE Application Support"}, {cn_assignmentgroup: "SMWE Help Desk"},…]

Image url - https://app.gemoo.com/share/image-annotation/647178445417881600?codeId=Mll849oepz9ga&origin=imageurlgenerator&card=647178442230210560

JS code -

console.log(response);
                            for (var i =0; i< response.length ;i++) {
                                console.log(response[i]);
                            }
0 likes
1 reply
Tray2's avatar

It's quite simple.

let responseJson = JSON.parse(response);

console.log(responseJson.title);

Please or to participate in this conversation.