title: Gson: How to change output of Enum
body: <p>I've this <em>enum</em>:</p>
  
  <pre><code>enum RequestStatus {
    OK(200), NOT_FOUND(400);
  
    private final int code;
  
    RequestStatus(int code) {
      this.code = code;
    }
  
    public int getCode() {
      return this.code;
    }
  };
  </code></pre>
  
  <p>and in my Request-class, I have this field: <code>private RequestStatus status</code>.</p>
  
  <p>When using Gson to convert the Java object to JSON the result is like:</p>
  
  <pre><code>"status": "OK"
  </code></pre>
  
  <p>How can I change my GsonBuilder or my Enum object to give me an output like:</p>
  
  <pre><code>"status": {
    "value" : "OK",
    "code" : 200
  }
  </code></pre>