refactoring of JsonGeneratorHelper