algoliasearch/src/offline/java/com/algolia/search/saas/OfflineIndex.java
private static JSONObject objectWithID(@NonNull JSONObject object, @NonNull String objectID) {
        try {
            // WARNING: Could not find a better way to clone the object.
            JSONObject patchedObject = new JSONObject(object.toString());
            patchedObject.put("objectID", objectID);
            return patchedObject;
        }
        catch (JSONException e) {
            throw new RuntimeException(e); // should never happen
        }
    }
private static JSONObject objectWithID(@NonNull JSONObject object, @NonNull String objectID) {
        try {
            // WARNING: Could not find a better way to clone the object.
            JSONObject patchedObject = new JSONObject(object.toString());
            patchedObject.put("objectID", objectID);
            return patchedObject;
        }
        catch (JSONException e) {
            throw new RuntimeException(e); // should never happen
        }
    }
private static JSONObject objectWithID ( @ NonNull JSONObject object , @ NonNull String objectID ) { try { // WARNING: Could not find a better way to clone the object. JSONObject patchedObject = new JSONObject ( object . toString ( ) ) ; patchedObject . put ( "objectID" , objectID ) ; return patchedObject ; } catch ( JSONException e ) { throw new RuntimeException ( e ) ; // should never happen } }
Create a copy of a JSON object with a specific <code>objectID</code> attribute.

@param object The object to copy.
@param objectID The ID for the new object.
@return A new JSON object with the specified object ID.
Create a copy of a JSON object with a specific <code > objectID< / code > attribute .