Backbone.JS toJSON()

The Backbone.JS toJSON() model is used to get a copy of the attributes as an object for JSON stringification.

Syntax:

Model.toJSON (options)

Parameters: options: This parameter is used to specify options like the variable name and id.

Example:



  
Example  
  
  
  
 

  

Output:

{"subject":"Gratitude","msg":"Thanks for everything."}

Explanation: A copy of the attributes is returned as an object for JSON stringification.

Please follow and like us:
Content Protection by DMCA.com