app/src/main/java/org/andstatus/app/util/JsonUtils.java
/** Creates new shallow copy without the keyToRemove */
Creates new shallow copy without the keyToRemove
Creates new shallow copy without the keyToRemove
@NonNull
    public static JSONObject remove(JSONObject jso, String keyToRemove) {
        if (isEmpty(jso)) return new JSONObject();
        try {
            Iterator<String> iterator = jso.keys();
            JSONObject out = new JSONObject();
            while (iterator.hasNext()) {
                String key = iterator.next();
                if (!key.equals(keyToRemove)) {
                    out.put(key, jso.get(key));
                }
            }
            return out;
        } catch (JSONException e) {
            MyLog.w(JsonUtils.class, "remove '" + keyToRemove + "'", e);
        }
        return jso;
    }
@ NonNull public static JSONObject remove ( JSONObject jso , String keyToRemove ) { if ( isEmpty ( jso ) ) return new JSONObject ( ) ; try { Iterator < String > iterator = jso . keys ( ) ; JSONObject out = new JSONObject ( ) ; while ( iterator . hasNext ( ) ) { String key = iterator . next ( ) ; if ( ! key . equals ( keyToRemove ) ) { out . put ( key , jso . get ( key ) ) ; } } return out ; } catch ( JSONException e ) { MyLog . w ( JsonUtils . class , "remove '" + keyToRemove + "'" , e ) ; } return jso ; }
Creates new shallow copy without the keyToRemove
Creates new shallow copy without the keyToRemove