James mentions "law" ten times in his epistle, and in each case it is the moral law. He has nothing but good to say about it. James, taught by Christ, exalts the law—he glorifies it, identifying it with the gospel.
In James 1, when speaking of the Word and the importance of hearing and doing it, he, in the same breath, speaks of looking into "the perfect law of liberty." James looks at the law as explained in the gospel—the gospel shows the law in its spirituality—as the guide of the true Christian who has entered into the spirit of the law or is keeping the spirit of the law as well as the letter.
Even in the Old Testament, as Psalms 19 and 119 specifically show, it was possible for spiritually-minded people to see the beauty of the law and find delight in its precepts.
Martin G. Collins
The Law's Purpose and Intent
Only by careful study of God's Word, the ultimate standard of thought, speech, and conduct, can we know what is right and wrong. We must follow our study with honest and truthful comparison of those words with our own lives. If we read the words of God and walk away, forgetting what we saw, we deceive ourselves. None of us compares favorably with what we read in Scripture, so we must make changes. James says our religion—our practice of God's way of life—is vain if we omit either the positive instructions (visiting widows and orphans) or the negative ones (removing the spots from our character).
Overcoming (Part 1): Self-Deception
Other Forerunner Commentary entries containing James 1:22: