title: Can't access to ViewBag (have a list of JSON objects ) from javascript
body: <p>In My ASPMVC Code I filled the ViewBag.Contacts variable by use the below code </p>
  
  <pre><code>        var contactsGroups = EntityContext.DBContext.TS_GetConfirmedContacts(typeId,AccountId).GroupBy(c=&gt;c.GroupName);
         // JSONGroup Custom object  
         List&lt;JSONGroup&gt; jsonContactsGroups = new List&lt;JSONGroup&gt;();
          foreach (var group in contactsGroups)
          {
              jsonContactsGroups.Add(new JSONGroup
              {
                  GroupName = group.Key,
                  Objects = new List&lt;object&gt;(group.ToList())
              });
          }
  
  
          var result = new JsonResult
          {
              Data = jsonContactsGroups,
              JsonRequestBehavior = JsonRequestBehavior.AllowGet
          };
  
          ViewBag.Contacts =  result;
  </code></pre>
  
  <p>When I am tried to access the ViewBag.Contacts variable from javascript by this Code</p>
  
  <pre><code>var contactData = '@ViewBag.Contacts';
  </code></pre>
  
  <p>After debugging the value returned as string  [from console]</p>
  
  <blockquote>
    <p>var contactData = 'System.Web.Mvc.JsonResult';</p>
  </blockquote>