title: How can My Asp.Net C# class return a json format
body: <p>How would like a class that will return a json format.</p>
  
  <p>This method work Great in the controller
  but when I want to put in a Class, the Json object don't seem to exist.</p>
  
  <pre><code> public JsonResult Test()
   {
        //Error   1   The name 'Json' does not exist in the current context   C:\inetpub\wwwroot\mvcinfosite\mvcinfosite\Validation\ValidationClass\BaseValidator.cs  66  20  mvcinfosite
        return Json(new { errMsg = "test" });
   }
  </code></pre>
  
  <p>I want to put that code in a simple class. I want be able to call this method in many controllers.</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong> <br />
  This is my Class <strong>(Where the code dosen't work)</strong></p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using mvcinfosite.Models;
  using mvcinfosite.Base;
  using System.Web.Mvc;
  
  public class BaseValidator
  {
       public JsonResult Test()
       {
           return Json(new { errMsg = "test" });
       }
  }
  </code></pre>