title: Return Error through JsonResult Without [] Appended
body: <p>I'm pretty new to all this so please bear with me. I am calling a JsonResult method in my controller via AJAX. The JsonResult action method calls a private method that calls a stored procedure, loads up the data into an object, and returns it to be serialized and returned to the client AJAX call. </p>
  
  <p>That all works great, but when I catch Oracle exceptions I want to be able to return the error. I am currently just doing a Response.Write in my catch but because it's going through a JsonResult action it will append [] to the message. I could always trim that on the client side but I get the feeling I shouldn't be doing it this way, or there is a better cleaner way.</p>
  
  <p>AJAX Call:</p>
  
  <pre><code>    $.ajax({
      type: "GET",
      url: "/Controller/JsonResultActionMethod",
      dataType: "json",
      data: { someVar: someData },
      cache: false,
      success: function (results) {
          // Do some stuff
      },
      error: function (xhr, status, error) {
          alert(xhr.responseText);
      }
  });
  </code></pre>
  
  <p>JsonResult Action:</p>
  
  <pre><code>    [HttpGet]
      public JsonResult JsonResultActionMethod(string someVar)
      {
          var myObjects = GetObjects(someVar);
          return Json(myObjects , JsonRequestBehavior.AllowGet);
      }
  </code></pre>
  
  <p>GetObjects Method (Calls stored procedure and returns list of myObject)</p>
  
  <pre><code>    private List&lt;myObject&gt; GetObjects(string someVar)
      {
          var myObjList = new List&lt;InspectionModel&gt;();
  
          try
          {
              // call stored procedure, create new instance of object, and load up myObjList. All of this works just fine
          }
          catch (OracleException ex)
          {
              // error handling is a bit more robust. simplified for example. ex.Message, when returned to page and displayed via xhr.responseText will appear as such: "Some error message from Oracle[]"
              Response.Write(ex.Message);
          }
  
          return disasterList;
      }
  </code></pre>
  
  <p>Is there a way to return error messages from the catch{} in such a way that it could be serialized into a JSON object? I thought about adding a List property to myObject and storing errors in there. Is there a better way to do this?</p>