Braintree/src/main/java/com/braintreepayments/api/models/AmericanExpressRewardsBalance.java
public static AmericanExpressRewardsBalance fromJson(String jsonString) throws JSONException {
        JSONObject json = new JSONObject(jsonString);

        AmericanExpressRewardsBalance rewardsBalance = new AmericanExpressRewardsBalance();

        if (json.has(ERROR_KEY)) {
            JSONObject errorJson = json.getJSONObject(ERROR_KEY);
            rewardsBalance.mErrorMessage = errorJson.getString(ERROR_MESSAGE_KEY);
            rewardsBalance.mErrorCode = errorJson.getString(ERROR_CODE_KEY);
        }

        rewardsBalance.mConversionRate = Json.optString(json, CONVERSION_RATE_KEY, null);
        rewardsBalance.mCurrencyAmount = Json.optString(json, CURRENCY_AMOUNT_KEY, null);
        rewardsBalance.mCurrencyIsoCode = Json.optString(json, CURRENCY_ISO_CODE_KEY, null);
        rewardsBalance.mRequestId = Json.optString(json, REQUEST_ID_KEY, null);
        rewardsBalance.mRewardsAmount = Json.optString(json, REWARDS_AMOUNT_KEY, null);
        rewardsBalance.mRewardsUnit = Json.optString(json, REWARDS_UNIT_KEY, null);

        return rewardsBalance;
    }
public static AmericanExpressRewardsBalance fromJson(String jsonString) throws JSONException {
        JSONObject json = new JSONObject(jsonString);

        AmericanExpressRewardsBalance rewardsBalance = new AmericanExpressRewardsBalance();

        if (json.has(ERROR_KEY)) {
            JSONObject errorJson = json.getJSONObject(ERROR_KEY);
            rewardsBalance.mErrorMessage = errorJson.getString(ERROR_MESSAGE_KEY);
            rewardsBalance.mErrorCode = errorJson.getString(ERROR_CODE_KEY);
        }

        rewardsBalance.mConversionRate = Json.optString(json, CONVERSION_RATE_KEY, null);
        rewardsBalance.mCurrencyAmount = Json.optString(json, CURRENCY_AMOUNT_KEY, null);
        rewardsBalance.mCurrencyIsoCode = Json.optString(json, CURRENCY_ISO_CODE_KEY, null);
        rewardsBalance.mRequestId = Json.optString(json, REQUEST_ID_KEY, null);
        rewardsBalance.mRewardsAmount = Json.optString(json, REWARDS_AMOUNT_KEY, null);
        rewardsBalance.mRewardsUnit = Json.optString(json, REWARDS_UNIT_KEY, null);

        return rewardsBalance;
    }
public static AmericanExpressRewardsBalance fromJson ( String jsonString ) throws JSONException { JSONObject json = new JSONObject ( jsonString ) ; AmericanExpressRewardsBalance rewardsBalance = new AmericanExpressRewardsBalance ( ) ; if ( json . has ( ERROR_KEY ) ) { JSONObject errorJson = json . getJSONObject ( ERROR_KEY ) ; rewardsBalance . mErrorMessage = errorJson . getString ( ERROR_MESSAGE_KEY ) ; rewardsBalance . mErrorCode = errorJson . getString ( ERROR_CODE_KEY ) ; } rewardsBalance . mConversionRate = Json . optString ( json , CONVERSION_RATE_KEY , null ) ; rewardsBalance . mCurrencyAmount = Json . optString ( json , CURRENCY_AMOUNT_KEY , null ) ; rewardsBalance . mCurrencyIsoCode = Json . optString ( json , CURRENCY_ISO_CODE_KEY , null ) ; rewardsBalance . mRequestId = Json . optString ( json , REQUEST_ID_KEY , null ) ; rewardsBalance . mRewardsAmount = Json . optString ( json , REWARDS_AMOUNT_KEY , null ) ; rewardsBalance . mRewardsUnit = Json . optString ( json , REWARDS_UNIT_KEY , null ) ; return rewardsBalance ; }
Used to parse a response from the Braintree Gateway to be used for American Express rewards balance.

@param jsonString The json response from the Braintree Gateway American Express rewards balance route.
@return The {@link com.braintreepayments.api.models.AmericanExpressRewardsBalance} with rewards balance data.
@throws JSONException when parsing fails.
Used to parse a response from the Braintree Gateway to be used for American Express rewards balance .