Braintree/src/main/java/com/braintreepayments/api/models/PaymentMethodNonce.java
@Nullable
    public static PaymentMethodNonce parsePaymentMethodNonces(JSONObject json, String type) throws JSONException {
        switch (type) {
            case CardNonce.TYPE:
                if (json.has(CardNonce.API_RESOURCE_KEY) || json.has(CardNonce.DATA_KEY)) {
                    return CardNonce.fromJson(json.toString());
                } else {
                    CardNonce cardNonce = new CardNonce();
                    cardNonce.fromJson(json);
                    return cardNonce;
                }
            case PayPalAccountNonce.TYPE:
                if (json.has(PayPalAccountNonce.API_RESOURCE_KEY)) {
                    return PayPalAccountNonce.fromJson(json.toString());
                } else {
                    PayPalAccountNonce payPalAccountNonce = new PayPalAccountNonce();
                    payPalAccountNonce.fromJson(json);
                    return payPalAccountNonce;
                }
            case VenmoAccountNonce.TYPE:
                if (json.has(VenmoAccountNonce.API_RESOURCE_KEY)) {
                    return VenmoAccountNonce.fromJson(json.toString());
                } else {
                    VenmoAccountNonce venmoAccountNonce = new VenmoAccountNonce();
                    venmoAccountNonce.fromJson(json);
                    return venmoAccountNonce;
                }
            case VisaCheckoutNonce.TYPE:
                if (json.has(VisaCheckoutNonce.API_RESOURCE_KEY)) {
                    return VisaCheckoutNonce.fromJson(json.toString());
                } else {
                    VisaCheckoutNonce visaCheckoutNonce = new VisaCheckoutNonce();
                    visaCheckoutNonce.fromJson(json);
                    return visaCheckoutNonce;
                }
            default:
                return null;
        }
    }
@Nullable
    public static PaymentMethodNonce parsePaymentMethodNonces(JSONObject json, String type) throws JSONException {
        switch (type) {
            case CardNonce.TYPE:
                if (json.has(CardNonce.API_RESOURCE_KEY) || json.has(CardNonce.DATA_KEY)) {
                    return CardNonce.fromJson(json.toString());
                } else {
                    CardNonce cardNonce = new CardNonce();
                    cardNonce.fromJson(json);
                    return cardNonce;
                }
            case PayPalAccountNonce.TYPE:
                if (json.has(PayPalAccountNonce.API_RESOURCE_KEY)) {
                    return PayPalAccountNonce.fromJson(json.toString());
                } else {
                    PayPalAccountNonce payPalAccountNonce = new PayPalAccountNonce();
                    payPalAccountNonce.fromJson(json);
                    return payPalAccountNonce;
                }
            case VenmoAccountNonce.TYPE:
                if (json.has(VenmoAccountNonce.API_RESOURCE_KEY)) {
                    return VenmoAccountNonce.fromJson(json.toString());
                } else {
                    VenmoAccountNonce venmoAccountNonce = new VenmoAccountNonce();
                    venmoAccountNonce.fromJson(json);
                    return venmoAccountNonce;
                }
            case VisaCheckoutNonce.TYPE:
                if (json.has(VisaCheckoutNonce.API_RESOURCE_KEY)) {
                    return VisaCheckoutNonce.fromJson(json.toString());
                } else {
                    VisaCheckoutNonce visaCheckoutNonce = new VisaCheckoutNonce();
                    visaCheckoutNonce.fromJson(json);
                    return visaCheckoutNonce;
                }
            default:
                return null;
        }
    }
Parses a {@link PaymentMethodNonce} from json.

@param json {@link JSONObject} representation of a {@link PaymentMethodNonce}.
@param type The {@link String} type of the {@link PaymentMethodNonce}.
@return {@link PaymentMethodNonce}
@throws JSONException