serialize

  • function
can.Observe.prototype.serialize  

Serialize this object to something that can be passed to JSON.stringify.

observe.serialize()

Get the serialized Object form of the observe. Serialized data is typically used to send back to a server.

o.serialize() //-> { name: 'Justin' }

Serialize currently returns the same data as [can.Observe.prototype.attrs]. However, in future versions, serialize will be able to return serialized data similar to can.Model. The following will work:

new Observe({time: new Date()})
  .serialize() //-> { time: 1319666613663 }

Returns

{Object}

a JavaScript Object that can be serialized with JSON.stringify or other methods.