Juniper berries are sometimes used in cooking, most often to flavour sauerkraut and when cooking game meats such as venison. However, juniper berries are not commonly found in the house, sometimes forcing you to choose an alternative to mimic their flavour.
Gin is an alcohol made from juniper berries. It can also be used as a cooking substitute if juniper berries aren't available. According to Cook's Thesaurus, use one teaspoon of gin for every two berries the recipe calls for.
Other spices can also step in for the flavour of juniper berries. Both crushed bay leaves or smashed caraway seeds can be used, even though the flavour is slightly different. You can use equal parts of both to stand in for juniper berries.
Gin works best when used as a substitute in a sauce for game. However, if none of these alternatives are available, you can use another flavour like onion or garlic to stand in for the juniper berries.