Code example for Gson

  private Gson gson;
  protected void setUp() throws Exception { 
    gson = new Gson();
  public void testPrimitiveCharacterAutoboxedSerialization() { 
    assertEquals("\"A\"", gson.toJson('A'));
    assertEquals("\"A\"", gson.toJson('A', char.class));
    assertEquals("\"A\"", gson.toJson('A', Character.class));
  public void testPrimitiveCharacterAutoboxedDeserialization() { 
    char expected = 'a';
    char actual = gson.fromJson("a", char.class);
    assertEquals(expected, actual);
    actual = gson.fromJson("\"a\"", char.class);
Connect your IDE to all the code out there  Get Codota for Java