I have below json file and according to product, i would like to get value of URL using bash.
I can write code using if else loop but that is not effective because whenever file gets changed, i have to update code. Is there any easy way to get the values dynamically using bash? For e.g. ${PRODUCT}.${URL} value.
Code:
if [ "${PRODUCT}" = "PRODUCT1" ]; then
   URL="https://product1.url:6080"
elif [ "${PRODUCT}" = "PRODUCT2" ]; then
   URL="https://testing.url.test:8090"
elif [ "${PRODUCT}" = "PRODUCT3" ]; then
   URL="https://start.url:18080"
fi
File content:
{
    "DEVICE"     : "DESKTOP",
    "ACCOUNT"    : "test123",
    "PRODUCT1": {
        "URL"    : "https://product1.url:6080"
    },
    "PRODUCT2": {
        "URL"    : "https://testing.url.test:8090"
    },
    "PRODUCT3": {
        "URL"    : "https://start.url:18080"
    }
}
 
    