title: JSON Object representation
body: <p>I am new to JSON. so please help me....</p>
  
  <p>I am trying to write a Rest service that returns a Person object as follows:</p>
  
  <pre><code>PersonJSONAdapter implements JsonSerializer&lt;Person&gt;, JsonDeserializer&lt;Person&gt;
  {
      public JsonElement serialize(final Person src, final Type typeOfSrc, final      JsonSerializationContext context)
      {
          if (src == null)
              return null;
  
          final JsonObject retVal = new JsonObject();
  
          retVal.addProperty("firstname", src.getFirstname());
          retVal.addProperty("lastname", src.getLastname());
  
          return retVal;
  }
  </code></pre>
  
  <p>so with this the output of the JSON looks like:
      { "firstname" : "XXX",
        "lastname" : "YYY"
      }</p>
  
  <p>How can I make this one look like
      “Person” 
      {
      “firstname”: “XXX”,
      "lastname":"YYY"
      }</p>
  
  <p>Thanks for looking...</p>