Refactored the code to extend JsonFormatter instead.