refactor json parser