how to emit serialize JSON