They both are right.
日本語をべんきょうします - Studying Japanese
日本語のべんきょうをします - More like saying... Doing Japanese Study.
I'd use 今日日本語を勉強します to say "I'm studying Japanese today". If someone asked me what I was doing and I just said "べんきょうしています", and they followed up with "what kind of study are you doing?", I would reply with "日本語の勉強をします".
Hopefully this can give some of an example on the subtle difference. It's really context and you could probably use either for an interchangeable answer. Neither of the answers are wrong though.