title: Should an API return NULL for an int parameter? + How to handle
body: <p>At the moment our API is returning <code>NULL</code> for any <code>int</code> parameters which don't have a value.</p>
  
  <p>e.g. In our user api one of our parameters looks like this:</p>
  
  <pre><code>{
      ...
      "user_id":NULL
      ...
  }
  </code></pre>
  
  <p>I understand this can't be <code>0</code> as that could be a valid response, but having a <code>NULL</code> pointer is causing all sorts of issues because <code>int</code>s can't be <code>NULL</code> pointers.</p>
  
  <p>My thought was that these values should be left out altogether - then they would return <code>nil</code> values (in objective c, e.g. <code>[dictionary objectForKey:@"user_id"] == nil</code>) which seems more appropriate, and isn't checking for a null pointer (which seems wrong, there is a difference between an int and a pointer).</p>
  
  <p>Otherwise, a work around would be to make it into an <code>NSNumber</code> object which requires a pointer and can therefore be <code>NULL</code>. Then I can do something like:</p>
  
  <pre><code>NSNumber *userID = [dictionary objectForKey:@"user_id"];
  if(userID != [NSNull null]){
    // its not null
  }
  </code></pre>
  
  <p>But to me this feels fundamentally wrong, and the <code>NSNumber</code> documentation says things like:</p>
  
  <blockquote>
    <p>Note that number objects do not necessarily preserve the type they are created with.</p>
  </blockquote>
  
  <p>This also makes me feel dirty.</p>
  
  <p>(Then again, I'm initialising <code>NSDecimalNumber</code>s with strings... so I don't know why this would bother me...).</p>