Code example for Gson

Methods: fromJson

0
  /** 
   * Created in response to http://groups.google.com/group/google-gson/browse_thread/thread/2431d4a3d0d6cb23 
   */ 
  public void testAssignmentCharDeserialization() { 
    String json = "\"abc=\"";
    String value = gson.fromJson(json, String.class);
    assertEquals("abc=", value);
 
    json = "'abc\u003d'";
    value = gson.fromJson(json, String.class);
    assertEquals("abc=", value);
  } 
 
  public void testJavascriptKeywordsInStringSerialization() { 
    String value = "null true false function";
    String json = gson.toJson(value);
    assertEquals("\"" + value + "\"", json);
  } 
 
  public void testJavascriptKeywordsInStringDeserialization() {