title: How to hide properties on Azure Mobile Service responses?
body: <p>I have a Mobile Service with Model classes and DTO classes. I mapped these using Fluent API and got it to work to perform CRUD operations, but I have a problem with the JSON responses returned in some instances.</p>
  
  <p>Take for example a User entity with user name and password. To register a user I have my PostUserDTO method like this:</p>
  
  <pre><code>    // POST tables/UserDTO
      public async Task&lt;IHttpActionResult&gt; PostUserDTO(UserDTO item)
      {
          string hashString = PasswordHash.CreateHash(item.Password);
          item.Password = hashString;
          UserDTO current = await InsertAsync(item);
          current.Password = "";
          return CreatedAtRoute("Tables", new { id = current.Id }, current);
      }
  </code></pre>
  
  <p>On the method I read the password property sent from the client and then proceed to hash it with a salt, replace the value in the object sent and save it to the database, then I proceed to empty the password so the hashed result isn't returned. </p>
  
  <p>In this case the best practice would be to omit the password property from the response, this also should happen when retrieving all of the users in the table, I only want to return specific information, some information generated by my server should stay out from the response.</p>
  
  <p>How can I select or alter the information from the responses? Do I have to create other DTOs for every kind of response I desire? </p>