modify JSON encode method