[Rakefile] Improve task to convert to the JSON format