title: how to remove the curly braces and user_cart string
body: <pre><code>public function addToCart($id){
  
  $course = Course::findOrfail($id); 
  
  $user =Auth::user();
  
  $cart_array = array();
  
  $cart = $user-&gt;user_cart;
  if ($cart == '') {
    array_push($cart_array, array('user_cart' =&gt; $course-&gt;id));
    // print_r($cart_array);
      } else {
          $founder = false;
          $cart_array = json_decode($cart, true);
          for ($i = 0; $i &lt; count($cart_array); $i++) {
              $cart_for_eacch_course = $cart_array[$i];
              if ($cart_for_eacch_course['user_cart'] == $course-&gt;id) {
                  $founder = true;
              }
          }
        if (!$founder) {
      array_push($cart_array, array('user_cart' =&gt; $course-&gt;id));
    }
      }
  
  
  $data['user_cart'] = json_encode($cart_array);
  
  $update = User::where('id',$user-&gt;id)-&gt;update(['user_cart'=&gt; $cart_array]);
  </code></pre>
  <p><strong>Current Output</strong></p>
  <pre><code>[{&quot;user_cart&quot;:86},{&quot;user_cart&quot;:84}]
  </code></pre>
  <p><strong>Expected Output</strong></p>
  <pre><code>[84,86]
  </code></pre>
  <p>Now I am having the current Output but I want expected one. I tried by removing the json_encode but it didn't work for me.</p>