Refactor json util