9 And my
soul [nephesh] shall be joyful [giyl] in
the LORD [Y@hovah]: it shall rejoice [suws] in his salvation [y@shuw`ah].
9 Then my
soul will rejoice in the LORD, exulting in his salvation. ESV
Given the last few verses and the judgments that will come to all that are evil and/or disobedient, there is a change in this verse, to thanksgiving, for not only the righteous judgments that will be applied to evil, but to the deliverance from evil and from judgments that are certain to come.
This is the devils world. Problems are an integral part of this devils world.
It is not what God created. It is not what God intended.
When the universe was created, a very long time ago, it was created for the purpose of being inhabited, and as an inheritance for its inhabitants.
But of course that plan hit a few problems which began with Lucifer’s rebellion against God.
But despite the problems, the plan continues and will eventually result in an inheritance for those who will eventually live with God. Although this universe will be discarded and a new and better one will take its place, it will all work out for the better when history is finally concluded.
During our life, we will all face problems and difficulties, and for those who comply with Gods mandates, namely of pursuing a daily study and listening and learning and growing up in ones spiritual life, then there will be deliverance after deliverance from problem after problem.
The problems will never go away in this world, and likewise the deliverances will never end.
Thus the appreciation and rejoicing of those who actually have a genuine, and not a phony, relationship with God, through doctrine.