Code example for JSONObject

Methods: optJSONObject

0
    /** 
     * @return the end-user-facing localized error messages for form field validation errors resulting from 
     *         a form submission. 
     */ 
    public Map<String, List<String>> getLocalizedValidationErrorMessages() {
        JSONObject invalid_fields = raw_response.optJSONObject("invalid_fields");
        if (invalid_fields == null) return null;
        Map<String, List<String>> retval = new HashMap<String, List<String>>();
        List<String> keys = listFromIterator(invalid_fields.keys());
        for (String k : keys) {
            JSONArray fieldMessagesJson = invalid_fields.optJSONObject(k).optJSONArray("messages");
            retval.put(k, ((List<String>) ((List) jsonArrayToList(fieldMessagesJson)))); // bleh
        } 
 
        return retval;
    } 
 
    /** 
     * True if this object is an error representing a merge-flow is required to continue signing in. 
     * @return whether a merge-account-flow is required. 
     */