Minor refactoring for json parser