The volunteers strictly followed these diets for three days while in a London research facility, during which the scientists collected urine samples in the morning, afternoon and evening.

The research team then assessed the urine for hundreds of compounds, called metabolites, which are produced when certain foods are broken down in the body.

These included compounds that indicate red meat, chicken, fish, fruit and vegetables, as well as giving a picture of the amount of protein, fat, fibre and sugar eaten.

There are also compounds that point to specific foods such as citrus fruits, grapes and green leafy vegetables.

Using this information, experts were able to develop a ‘urine metabolite profile’ that indicated a healthy, balanced diet with a good intake of fruit and vegetables.

The idea is this ‘healthy diet’ profile could be compared to the diet profile from an individual’s urine, to provide an instant indicator of whether they are eating well or not.

Professor John Mathers, co-author from the Human Nutrition Research Centre at Newcastle University, said: “For the first time, this research offers an objective way of assessing the overall healthiness of people’s diets without all the hassles, biases and errors of recording what they’ve eaten.”

The team now hope to refine the technology by testing it on larger numbers of people.

They hope that the urine test, which should be available in two years, will be able to track patients’ diets and could even be used in weight loss programmes to monitor food intake.