json parser refactor