title: Remove `\t` from JSON created from multidimensional array (php)
body: <p>I am coverting array <code>$arrData</code> into JSON using <code>json_encode()</code>. I gatherd data from web and put it into php array. The problem is that output is full of tabs. I tried <code>$arrData = trim(preg_replace('/\t/', '', $arrData));</code> - but it deletes <code>\t</code> and all arrays inside arrays.
  Is there a way to remove all <code>\t</code> without destroying array structure?</p>
  
  <p>My array:</p>
  
  <pre><code> $arrData = array(
                  "chart" =&gt; array(
                      "caption" =&gt; "Number of visitors last week",
          "subCaption" =&gt; "Bakersfield Central vs Los Angeles Topanga",
          "captionFontSize" =&gt; "14",
          "subcaptionFontSize" =&gt; "14",
          "subcaptionFontBold" =&gt; "0",
          "paletteColors" =&gt; "#0075c2,#1aaf5d,#FF5733,#33B5FF",
          "bgcolor" =&gt; "#ffffff",
          "showBorder" =&gt; "0",
          "showShadow" =&gt; "0",
          "showCanvasBorder" =&gt; "0",
          "usePlotGradientColor" =&gt; "0",
          "legendBorderAlpha" =&gt; "0",
          "legendShadow" =&gt; "0",
          "showAxisLines" =&gt; "0",
          "showAlternateHGridColor" =&gt; "0",
          "divlineThickness" =&gt; "1",
          "divLineDashed" =&gt; "1",
          "divLineDashLen" =&gt; "1",
          "xAxisName" =&gt; "Day",
          "showValues" =&gt; "0"
                  )
              );
  $actualCategory = array( $rowData[0][1], $rowData[0][2], $rowData[0][3], $rowData[0][4], $rowData[0][5], $rowData[0][6], $rowData[0][7]);
                  $a = array( 
                  array( $rowData[2][1], $rowData[2][2], $rowData[2][3], $rowData[2][4], $rowData[2][5], $rowData[2][6], $rowData[2][7]),
                  array( $rowData[5][1], $rowData[5][2], $rowData[5][3], $rowData[5][4], $rowData[5][5], $rowData[5][6], $rowData[5][7]),
                  array( $rowData[8][1], $rowData[8][2], $rowData[8][3], $rowData[8][4], $rowData[8][5], $rowData[8][6], $rowData[8][7]),
                  array( $rowData[11][1], $rowData[11][2], $rowData[11][3], $rowData[11][4], $rowData[11][5], $rowData[11][6], $rowData[11][7])
                  );
  
  
                  $arrData['categories'] = array();
                  $arrData['categories']['category'] = array();
                  $arrData['dataset'] = array();
  
  
  
                  foreach ($actualCategory as $value) {
                      array_push($arrData['categories']['category'],
                          array(
                              'label' =&gt; $value
                          )
                      );
                  }
  
                  $q = 1;
                  for($z = 0;$z &lt;= 3; $z++){
  
                  $x[$z] = array('seriesname' =&gt; $rowData[$q][0], 'data' =&gt; array());
                      foreach ($a[$z] as $value) {
                          array_push($x[$z]['data'],
                              array(
                                 'value' =&gt; $value
                              )
                          );
                      }
                  $q = $q + 3;
                  }
      $arrData['dataset'] = $x;
  </code></pre>
  
  <p>My JSON code:</p>
  
  <pre><code>{
  "chart":{
  "caption":"Number of visitors last week",
  "subCaption":"Bakersfield Central vs Los Angeles Topanga",
  "captionFontSize":"14",
  "subcaptionFontSize":"14",
  "subcaptionFontBold":"0",
  "paletteColors":"#0075c2,#1aaf5d,#FF5733,#33B5FF",
  "bgcolor":"#ffffff",
  "showBorder":"0",
  "showShadow":"0",
  "showCanvasBorder":"0",
  "usePlotGradientColor":"0",
  "legendBorderAlpha":"0",
  "legendShadow":"0",
  "showAxisLines":"0",
  "showAlternateHGridColor":"0",
  "divlineThickness":"1",
  "divLineDashed":"1",
  "divLineDashLen":"1",
  "xAxisName":"Day",
  "showValues":"0"},
  "categories":{
  "category":[
  {"label":" \t \t N. \t 12\/02 \t "},
  {"label":" \t \t Pn. \t 13\/02 \t "},
  {"label":" \t \t Wt. \t 14\/02 \t "},
  {"label":" \t \t \u015ar. \t 15\/02 \t "},
  {"label":" \t \t Cz. \t 16\/02 \t "},
  {"label":" \t \t Pt. \t 17\/02 \t "},
  {"label":" \t \t So. \t 18\/02 \t "}]},
  "dataset":[
  {
  "seriesname":" \t IRDN \t ",
  "data":[
  {"value":" \t 142.59 \t "},
  {"value":" \t 174.88 \t "},
  {"value":" \t 176.97 \t "},
  {"value":" \t 182.48 \t "},
  {"value":" \t 160.15 \t "},
  {"value":" \t 160.72 \t "},
  {"value":" \t 165.47 \t "}]},
  {
  "seriesname":" \t \t \t SIRDN \t \t ",
  "data":[{"value":" \t 148.81 \t \t "},
  {"value":" \t 197.29 \t \t "},
  {"value":" \t 202.27 \t \t "},
  {"value":" \t 211.93 \t \t "},
  {"value":" \t 177.87 \t \t "},
  {"value":" \t 179.37 \t \t "},
  {"value":" \t 177.69 \t \t "}]},
  {
  "seriesname":" \t \t IRDN24 \t \t ",
  "data":[{"value":" \t 140.31 \t \t "},
  {"value":" \t 174.50 \t \t "},
  {"value":" \t 180.38 \t \t "},
  {"value":" \t 187.70 \t \t "},
  {"value":" \t 161.91 \t \t "},
  {"value":" \t 161.62 \t \t "},
  {"value":" \t 160.98 \t \t "}]},
  {
  "seriesname":" \t \t IRDN 8.22 \t \t ",
  "data":[{"value":" \t 147.33 \t "},
  {"value":" \t 197.02 \t "},
  {"value":" \t 202.21 \t "},
  {"value":" \t 211.28 \t "},
  {"value":" \t 178.11 \t "},
  {"value":" \t 179.32 \t "},
  {"value":" \t 176.31 \t "}
  ]}]}
  </code></pre>