Instead of manually assembling the JSON you could just use the Play JSON API.