title: PHP json_encode - null & int values returned as strings
body: <p>Why would this array:</p>
  
  <pre><code>Array
  (
      [EventCode] =&gt; 20140709TXAO
      [ShortParticipant] =&gt; Array
          (
              [Address1] =&gt; null
              [Address2] =&gt; null
              [Address3] =&gt; null
              [City] =&gt; null
              [Country] =&gt; null
              [Email] =&gt; kkardashian@kkardashain.com
              [Employer] =&gt; TNA
              [FirstName] =&gt; Kim
              [LastName] =&gt; Kardashian
              [PID] =&gt; 1180133
              [Result] =&gt; null
              [State] =&gt; null
          )
  
  )
  </code></pre>
  
  <p>be converted to the JSON below with json_encode? Note the null values are being converted to "null"!!! That is causing issues with my receiver.</p>
  
  <pre><code>{
      "EventCode": "20140709TXAO",
      "ShortParticipant": {
          "Address1": "null",
          "Address2": "null",
          "Address3": "null",
          "City": "null",
          "Country": "null",
          "Email": "kkardashian@kkardashain.com",
          "Employer": "TNA",
          "FirstName": "Kim",
          "LastName": "Kardashian",
          "PID": "1180133",
          "State": "null"
      }
  }
  </code></pre>
  
  <p>Even the int value is being converted to a string, "1180133".</p>
  
  <p>var_dump results:</p>
  
  <pre><code>array
    'EventCode' =&gt; string '20140709TXAO' (length=12)
    'ShortParticipant' =&gt; 
      array
        'Address1' =&gt; string 'null' (length=4)
        'Address2' =&gt; string 'null' (length=4)
        'Address3' =&gt; string 'null' (length=4)
        'City' =&gt; string 'null' (length=4)
        'Country' =&gt; string 'null' (length=4)
        'Email' =&gt; string 'kkardashian@kkardashain.com' (length=27)
        'Employer' =&gt; string 'TNA' (length=3)
        'FirstName' =&gt; string 'Kim' (length=3)
        'LastName' =&gt; string 'Kardashian' (length=10)
        'PID' =&gt; string '1180133' (length=7)
        'Result' =&gt; string 'null' (length=4)
        'State' =&gt; string 'null' (length=4)
  </code></pre>
  
  <p>Javascript code:</p>
  
  <pre><code>function callRegStatus(eventcode, RegStatus) {
      inputdata = {LogonTicket: logonticket, 
                   data2: $.extend(true, {EventCode: eventcode}, 
                                         {ShortParticipant: RegStatus})};
      ok_to_proceed = false;
      $.ajax({async: false
            , type:'POST'
            , url: REGFUNCTIONS_URL
            , data: inputdata
            , dataType: 'json'
            , success: function(data) {          
                  ok_to_proceed = true;
              }
            , error: function(jqXHR, textStatus, errorThrown) {
                  ok_to_proceed = false;
                  $("#error_message").html(jqXHR.responseText);
              }
      });
      return ok_to_proceed;
  }
  </code></pre>
  
  <p>EE Plugin code:</p>
  
  <pre><code> public function getRegStatus() {
      $data  = $_POST;
      $data2 = $data["data2"];
  
      $url = $this-&gt;server . '/RegStatus/'.$data["LogonTicket"];
      $options = array(CURLOPT_URL =&gt; $url,
                       CURLOPT_HEADER =&gt; false,
                       CURLOPT_SSL_VERIFYPEER =&gt; false,
                       CURLOPT_RETURNTRANSFER =&gt; true,
                       CURLOPT_POST =&gt; true,
                       CURLOPT_POSTFIELDS =&gt; json_encode($data2)
           );
      $ch = curl_init();
      curl_setopt_array($ch, $options);
  
      $RegStatusResult = curl_exec($ch);
  
      curl_close($ch); 
      return $RegStatusResult;
   }
  </code></pre>