title: how to get second level data from Stripe JSON object
body: <p>I have  function that is able to retrieve level 1 array data, but not level 2 in the return JSON string following a charge.</p>
  
  <pre><code>else if(!empty($_SESSION['SESS_PLAN_BUY_CODE'])){
         $pcharge = \Stripe\Customer::create(array(
         "source" =&gt; $_POST['stripeToken'],
         "plan" =&gt; $_SESSION['SESS_PLAN_BUY_CODE'],
         "email" =&gt; $_SESSION["SESS_EMAIL"]
         ));
      echo "My customer id is: " . $pcharge-&gt;id;
      echo'&lt;br&gt;';
      $stuff = json_decode($pcharge-&gt;subscriptions);
      var_dump($stuff);
  </code></pre>
  
  <p>Actual JSON return string:
  <a href="https://bpaste.net/show/18641992272a" rel="nofollow">JSON</a></p>
  
  <p>the output from the above code is:</p>
  
  <p>My customer <code>id</code> is: <code>cus_6cvCQdpdhmQlGe</code>
  <code>NULL</code></p>
  
  <p>expected output:</p>
  
  <p>My customer <code>id</code> is: <code>cus_6cvCQdpdhmQlGe</code>
  <code>1</code></p>
  
  <p>I have tried:</p>
  
  <pre><code>$stuff = $pcharge-&gt;subscriptions[0];
  $stuff = $pcharge-&gt;subscriptions['total_count'];
  $stuff = json_decode($pcharge-&gt;subscriptions);
  </code></pre>
  
  <p>and  few loops
  I get either <code>NULL</code> or some other error indicating the programmer doesn't know what he is doing.</p>
  
  <p>How do I get to <code>level 2</code> and <code>level 3</code> data in the Stripe JSON return string?</p>