Basically, I have an JSON Object named map, to which I add a key and value whenever it is needed for temporary storage. So I need a function that checks if the key already exists in map and if it does exist then it adds a number to end of the key's name like _(number) and the number increases for every duplicate.
i.e (Just an example, I'm using the map for different purposes)
{
"hello": "world",
"hello_(1)": "do you like pizza?",
"hello_(2)": "https://google.com/"
}
Please do help me, Thanks!