Refactor json