OiO.lk English PHP How to extract and access data from JSON with PHP?
PHP

How to extract and access data from JSON with PHP?


I have this nested array below. How do I loop through each "cell" value in the "contacts" key? I have tried with a foreach loop but just not able to access the "cell" value

$jayParsedAry = [
    "ok" => true, 
    "data" => [
        "credits_used" => 10, 
        "parsed_request" => [
            "find" => [
                "tag_ids" => [
                    "all" => [
                        "123" 
                    ] 
                ], 
                "updatedAt" => [
                    "gte" => "2024-10-22T00:00:00.000Z" 
                ] 
            ], 
            "projection" => [
                "cell" => 1 
            ], 
            "options" => [
                "skip" => 0, 
                "limit" => 2 
            ] 
        ], 
        "contacts" => [
            [
                "_id" => "123", 
                "cell" => "12345" 
            ], 
            [
                "_id" => "123", 
                "cell" => "12345" 
            ] 
        ] 
    ], 
    "request_id" => "123" 
];



You need to sign in to view this answers

Exit mobile version