add jsx and modify encode method