[BUG #7665] serialize as JSON when appropriate content type