Q:

How to extract a variable from JSON object in php?

I am working on a website in which I want to extract JSON variable in php. The code which I have used for that is:
<div class="tab-pane" id="policies">
   <p> 
      <span class="heading_size">policies:</span>

   </p>
   <p class="text-justify mb-0 pb-5">
      <?php 
         echo strtolower($data['item']->company_policy->description); 
         ?>
   </p>
</div>

In the above code the following line  echo strtolower($data['item']->company_policy->description); doesn't seems to print anything  but for the debugging purpose when I have added <?php echo $data['item']; ?>, it is extracting the following snippets of JSON:
"company_policy": {
    "company_policy_id": 2,
    "uuid": "B4d2aa790",
    "name": "Reasonable",
    "description": "a.) Hello World. ",
    "cutoff_time": 96,
    "percentage": "1.00"
},

In order to extract the description from the above JSON, it is understood that I should be using             echo strtolower($data['item']->company_policy->description); but it doesn't seems to extract anything as explained above.

Problem Statement:
I am wondering what changes I should make in the above echo statement so that I am successfully able to fetch the data from the JSON.

A:

First you have decode json data by using json_decode
<?php $jsonData =  json_decode($data['item'], true); ?>

<div class="tab-pane" id="policies">
   <p> 
      <span class="heading_size">policies:</span>

   </p>
   <p class="text-justify mb-0 pb-5">
      <?php 
         echo strtolower($jsonData['company_policy']['description']); 
         ?>
   </p>
</div>

