refactor json support