title: How to return Json object on Web API Controller
body: <p>I used this below code on my asp.net controller to return Json object on my Ajax on javascript</p>
  
  <pre><code>public JsonResult myMethod()
  {
      // return a Json Object, you could define a new class
      return Json(new
      {
          Success = true, //error
          Message = "Success" //return exception
      });
  }
  </code></pre>
  
  <p>Jquery-Ajax:</p>
  
  <pre><code>$.ajax({
      type: "POST",
      url: url_ ,
      data: search,
      success: function(data) {   
          //Show Json Properties from Controller ( If Success == false show exception Message from controller )
          if (data.Success)  
          {
              alert(data.Message); //display success 
          }
          else
          {
              alert(data.Message) //display exception
          }
      },
      error: function(XMLHttpRequest, textStatus, errorThrown) {
          alert("error: " + XMLHttpRequest.responseText);
      },
      dataType: 'json'
  });
  </code></pre>
  
  <p>How can this be done on Web Api Controller?</p>
  
  <p>Can you give me some examples or url as reference.</p>
  
  <p>Thanks and Regards</p>