function selectOptionByObjectValue(selectElementId, targetObject) {
const selectElement = document.getElementById(selectElementId);
if (!selectElement) {
console.error("Select element not found with id:", selectElementId);
return;
}
const targetJsonString = JSON.stringify(targetObject);
for (let i = 0; i < selectElement.options.length; i++) {
const option = selectElement.options[i];
if (option.value === targetJsonString) {
selectElement.selectedIndex = i;
return;
}
}
console.warn("No matching option found for object:", targetObject);
}