title: Why static fields not serialized using google.gson.GsonBuilder JSON parser?
body: <p>I tried <em>serializing</em> an object using <strong>google.gson.GsonBuilder</strong> as follows:</p>
  
  <pre><code>public class JsonHelper
  {
      public static String ToJson(Object o, Type oType)
      {
          Gson gson = new().setPrettyPrinting().setDateFormat("yyyy-MM-dd'T'HH:mm:ss").create();
          gson.toJson(o, oType);
      }
  }
  
  public class JsonTest
  {
     public static String staticField;
  
     public static String ToJson()
     {
         JsonTest newJsonTest = new JsonTest();
         newJsonTest.staticField = TelephoneStatus.GetPhoneIMEI(); // let's say we use static field to keep IMEI
  
         Type oType = new TypeToken&lt;JsonTest&gt;(){}.getType();
         return JsonHelper.ToJson(newJsonTest, oType);
     }
  }
  </code></pre>
  
  <p><em>Return value</em> for <code>JsonTest</code> class method <code>ToJson()</code> is empty. If i change <code>staticField</code> field declaration to be <strong>non-static</strong>, it works as expected. Considering why static fields are not serialized, should it be considered as a <strong>bug</strong>? Or is it considered unnecessary?</p>
  
  <p>If i had a <em>list</em> of <code>JsonTest</code> i wouldn't expect having static field parsed and written <em>multiple times</em> but <em>once</em>. However, isn't it better than missing it at all?</p>