Code example for JsonPrimitive

0
public class UserSerializer implements JsonSerializer<User> { 
 
    @Override 
    public JsonElement serialize(final User src, final Type type, final JsonSerializationContext jsonSerializationContext) { 
        final String j = GsonFactory.getInstance().toJson(src); 
        return new JsonPrimitive(j); 
    } 
}