Braintree/src/main/java/com/braintreepayments/api/models/PaymentMethodNonce.java
public static List<PaymentMethodNonce> parsePaymentMethodNonces(String jsonBody)
            throws JSONException {
        JSONArray paymentMethods = new JSONObject(jsonBody).getJSONArray(
                PAYMENT_METHOD_NONCE_COLLECTION_KEY);

        if (paymentMethods == null) {
            return Collections.emptyList();
        }

        List<PaymentMethodNonce> paymentMethodsNonces = new ArrayList<>();
        JSONObject json;
        PaymentMethodNonce paymentMethodNonce;
        for(int i = 0; i < paymentMethods.length(); i++) {
            json = paymentMethods.getJSONObject(i);
            paymentMethodNonce = parsePaymentMethodNonces(json,
                    json.getString(PAYMENT_METHOD_TYPE_KEY));
            if (paymentMethodNonce != null) {
                paymentMethodsNonces.add(paymentMethodNonce);
            }
        }

        return paymentMethodsNonces;
    }
public static List<PaymentMethodNonce> parsePaymentMethodNonces(String jsonBody)
            throws JSONException {
        JSONArray paymentMethods = new JSONObject(jsonBody).getJSONArray(
                PAYMENT_METHOD_NONCE_COLLECTION_KEY);

        if (paymentMethods == null) {
            return Collections.emptyList();
        }

        List<PaymentMethodNonce> paymentMethodsNonces = new ArrayList<>();
        JSONObject json;
        PaymentMethodNonce paymentMethodNonce;
        for(int i = 0; i < paymentMethods.length(); i++) {
            json = paymentMethods.getJSONObject(i);
            paymentMethodNonce = parsePaymentMethodNonces(json,
                    json.getString(PAYMENT_METHOD_TYPE_KEY));
            if (paymentMethodNonce != null) {
                paymentMethodsNonces.add(paymentMethodNonce);
            }
        }

        return paymentMethodsNonces;
    }
Parses a response from the Braintree gateway for a list of payment method nonces.

@param jsonBody Json-formatted String containing a list of {@link PaymentMethodNonce}s
@return List of {@link PaymentMethodNonce}s contained in jsonBody
@throws JSONException