Convert the given JSON string into an object using
<a href="https://github.com/google/gson">Gson</a>.

@param json
The input JSON.

@param klass
The class of the resultant object.

@return
A new object generated based on the input JSON.

@since 2.0
482096
public static <T> T fromJson(String json, Class<T> klass)
    {
        return GSON.fromJson(json, klass);
    }
556779
public static <M extends Model<M>> Model<M> jsonToModel(String json, Class<M> clazz){
		return FastJsonKit.parse(json, clazz);
	}
481113
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof TextValue)){
    return new TextValue(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(TextValue.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
1006347
protected JSONObject getJSONObject(final String jsonString) {
    JSONObject json = new JSONObject();
    try {
      json = new JSONObject(jsonString);
    }
    catch(NullPointerException e) {
      LOGGER.error("JSON string cannot be null.", e);
    }
    catch(JSONException e) {
      LOGGER.error("Could not parse string into JSONObject.", e);
    }
    return json;
  }
110537
private Gson createGson() {

        GsonBuilder gsonBuilder = new GsonBuilder().disableHtmlEscaping().setLenient().

                addSerializationExclusionStrategy(new ExclusionStrategy() {
                    @Override
                    public boolean shouldSkipField(FieldAttributes f) {
                        return f.getAnnotation(SerializedName.class) == null;
                    }

                    @Override
                    public boolean shouldSkipClass(Class<?> clazz) {
                        return false;
                    }
                });

        return gsonBuilder.create();
    }
457476
public Object string_to_resource(Class<?> responseClass, String response)
	{
		Gson gson = new Gson();
		return gson.fromJson(response, responseClass);
	}
14888
public static <T extends MailChimpObject> T fromJson(String json, Class<T> clazz) {
		try {
			return MailChimpGsonFactory.createGson().fromJson(json, clazz);
		} catch(JsonParseException e) {
			throw new IllegalArgumentException(e);
		}
	}
78339
public <T> Response<T> toJsonResponse(Class<T> cls) {
        return new Response<>(this.url, this.statusCode, this.cookies, this.headers, readToJson(cls));
    }
575084
public static Object fromJSON(String jsonString){
        List<Token> tokens = Derulo.toTokens(jsonString);
        return fromJSON(tokens);
    }
1234595
@Override
  public String toJson() {

    GsonBuilder gson = new GsonBuilder();
    gson.registerTypeAdapterFactory(GeoJsonAdapterFactory.create());
    gson.registerTypeAdapterFactory(GeometryAdapterFactory.create());
    return gson.create().toJson(this);
  }
678055
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof GDate)){
    return new GDate(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(GDate.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
852376
@SuppressWarnings("UnusedDeclaration")
  public static Bindings fromJson( String json )
  {
    try
    {
      return PARSER.get().parseJson( json );
    }
    catch( ScriptException e )
    {
      throw new RuntimeException( e );
    }
  }
86499
public static Option fromJSON(String json) {
        Gson gson = new GsonBuilder().setPrettyPrinting().
                registerTypeAdapter(Series.class, new SeriesDeserializer()).
                registerTypeAdapter(Axis.class, new AxisDeserializer()).create();
        Option option = gson.fromJson(json, Option.class);
        return option;
    }
1062111
function(json){
  
  // Protect against forgetting the new keyword when calling the constructor
  if(!(this instanceof Base)){
    return new Base(json);
  }
  
  // If the given object is already an instance then just return it. DON'T copy it.
  if(Base.isInstance(json)){
    return json;
  }
  
  this.init(json);
}
520098
public static Schema fromJson(String json) {
        try{
            return JsonMappers.getMapper().readValue(json, Schema.class);
        } catch (Exception e){
            //TODO better exceptions
            throw new RuntimeException(e);
        }
    }
780942
function(json){
    
    // Protect against forgetting the new keyword when calling the constructor
    if(!(this instanceof Links)){
      return new Links(json);
    }
    
    // If the given object is already an instance then just return it. DON'T copy it.
    if(Links.isInstance(json)){
      return json;
    }
    
    this.init(json);
  }
1143639
public static <T extends Option> T fromJSON(String json, Class<T> type) {
        Gson gson = new GsonBuilder().setPrettyPrinting().
                registerTypeAdapter(Series.class, new SeriesDeserializer()).
                registerTypeAdapter(Axis.class, new AxisDeserializer()).create();
        return gson.fromJson(json, type);
    }