Ember model to json

后端 未结 12 1367
北恋
北恋 2020-12-13 13:55

I am looking for an efficient way to translate my Ember object to a json string, to use it in a websocket message below

/*
 * Model
 */

App.node = Ember.Obj         


        
12条回答
  •  孤城傲影
    2020-12-13 14:50

    App.io.emit('node', {node: node.toJSON()});

    Or if you have an ID property and want to include it:

    App.io.emit('node', {node: node.toJSON({includeId: true})});

提交回复
热议问题