public void settingFromJSON(JSONObject json) {
    jsonParams = json;
    try {
      JSONObject ldplParams = json.getJSONObject(LDPLParameters);
      JSONObject gpParams = json.getJSONObject(GPParameters);
      JSONObject optJSON = json.getJSONObject(OPTIONS);

      // LDPLParameters
      double n = ldplParams.getDouble("n");
      double A = ldplParams.getDouble("A");
      double fa = ldplParams.getDouble("fa");
      double fb = ldplParams.getDouble("fb");
      if (ldplParams.containsKey(HDIFF)) {
        double hDiff = ldplParams.getDouble(HDIFF);
        this.setParams(new double[] {n, A, fa, fb});
        this.setHDiff(hDiff);
      }

      // GPParamters
      JSONArray jarray = gpParams.getJSONArray("lengthes");
      lengthes = JSONUtils.array1DfromJSONArray(jarray);
      stdev = gpParams.getDouble("sigmaP");
      sigmaN = gpParams.getDouble("sigmaN");

      boolean useMask = (gpParams.getInt("useMask") == 1);
      int optConstVar = gpParams.getInt("constVar");

      gpLDPL.setUseMask(useMask);
      gpLDPL.setOptConstVar(optConstVar);

      // Options
      doHyperParameterOptimize = optJSON.optBoolean("optimizeHyperParameters");
      if (!doHyperParameterOptimize) {
        doHyperParameterOptimize = optJSON.optInt("optimizeHyperParameters") == 1;
      }

      // Optional variables
      if (gpParams.containsKey(ARRAYS)) {
        JSONObject jobjArrays = gpParams.getJSONObject(ARRAYS);
        gpLDPL.fromJSON(jobjArrays);
      }
      if (json.containsKey(LIKELIHOOD_MODEL)) {
        JSONObject likelihoodJSON = json.getJSONObject(LIKELIHOOD_MODEL);
        LikelihoodModel likelihoodModel = LikelihoodModelFactory.create(likelihoodJSON);
        gpLDPL.setLikelihoodModel(likelihoodModel);
      } else {
        System.out.println("The key for [" + LIKELIHOOD_MODEL + "] was not found.");
      }

      if (json.containsKey(BEACON_FILTER)) {
        JSONObject bfJSON = json.getJSONObject(BEACON_FILTER);
        BeaconFilter bf = BeaconFilterFactory.create(bfJSON);
        beaconFilter = bf;
      } else {
        System.out.println("The key for [" + BEACON_FILTER + "] was not found.");
      }

    } catch (JSONException e) {
      e.printStackTrace();
    }
  }