Daniel decided that he wouldn't pollute himself with the king's rations or the royal wine, and he appealed to the chief official in hopes that he wouldn't have to do so.
Now God had established faithful loyalty between Daniel and the chief official;
but the chief official said to Daniel, "I'm afraid of my master, the king, who has mandated what you are to eat and drink. What will happen if he sees your faces looking thinner than the other young men in your group? The king will have my head because of you!"
So Daniel spoke to the guard whom the chief official had appointed over Daniel, Hananiah, Mishael, and Azariah:
"Why not test your servants for ten days? You could give us a diet of vegetables to eat and water to drink.
Then compare our appearance to the appearance of the young men who eat the king's food. Then deal with your servants according to what you see."
The guard decided to go along with their plan and tested them for ten days.
At the end of ten days they looked better and healthier than all the young men who were eating the king's food.
So the guard kept taking away their rations and the wine they were supposed to drink and gave them vegetables instead.
And God gave knowledge, mastery of all literature, and wisdom to these four men. Daniel himself gained understanding of every type of vision and dream.