title: Trouble with importing a JSON file into C# object
body: <p>I am trying to import a JSON file into an object in C# (VS 2017 on Mac) to do further operations on it.</p>
  
  <p>I have this JSON file example:</p>
  
  <pre><code>{
    "subdomain": "mycompany",
    "name": "MyCompany Inc",
    "website": "https://www.mycompany.com",
    "edition": "DIRECTORY",
    "licensing":
    {
      "apps":
      [
        "boxnet"
      ]
    },
    "admin": {
      "profile":
      {
        "firstName": "John",
        "lastName": "Smith",
        "email": "joe@mycompany.com",
        "login": "joe@mycompany.com",
        "mobilePhone": null
      },
      "credentials":
      {
        "password":
        {
          "value": "NotAPassword"},
          "recovery_question":
          {
            "question": "Best Solution",
            "answer": "MyOne"
          }
        }
      }
    }
  }
  </code></pre>
  
  <p>So I generated a C# library to create an object type to import into:</p>
  
  <pre><code>using System;
  
  namespace OrgCustom
  {
      using System;
      using System.Net;
      using System.Collections.Generic;
  
      using Newtonsoft.Json;
  
      public class Licensing
      {
          public List&lt;string&gt; apps { get; set; }
      }
  
      public class Profile
      {
          public string firstName { get; set; }
          public string lastName { get; set; }
          public string email { get; set; }
          public string login { get; set; }
          public object mobilePhone { get; set; }
      }
  
      public class Password
      {
          public string value { get; set; }
      }
  
      public class RecoveryQuestion
      {
          public string question { get; set; }
          public string answer { get; set; }
      }
  
      public class Credentials
      {
          public Password password { get; set; }
          public RecoveryQuestion recovery_question { get; set; }
      }
  
      public class Admin
      {
          public Profile profile { get; set; }
          public Credentials credentials { get; set; }
      }
  
      public class Org
      {
          public string subdomain { get; set; }
          public string name { get; set; }
          public string website { get; set; }
          public string edition { get; set; }
          public Licensing licensing { get; set; }
          public Admin admin { get; set; }
      }
  }
  </code></pre>
  
  <p>And so, I should be able to import the file quite easily, using the Newtownsoft.Json library?</p>
  
  <p>Well, my program code is:</p>
  
  <pre><code>using System;
  using System.IO;
  using System.Runtime.Serialization.Json;
  using RestSharp;
  using Newtonsoft.Json;
  using OrgCustom;
  
  namespace TestStart
  {
      class Program
      {
          static void Main(string[] args)
          {
              string JSONstring = File.ReadAllText("CreateOrgExample.json");
  
              OrgCustom.Org objOrg = JsonConvert.DeserializeObject&lt;OrgCustom.Org&gt;(JSONstring);
              Console.WriteLine(objOrg.ToString());
          }
      }
  }
  </code></pre>
  
  <p>The problem is that when I run it, I get a message on the line from the Deserialize line that JsonConvert is a type, which is not valid in the given context.</p>
  
  <p>What am I doing wrong here? That line I saw in the Introduction to JSON with C# MVA course and I believe that it should work?!?!</p>
  
  <p>Thanks in advance,</p>
  
  <p>QuietLeni</p>