VOOZH about

URL: https://www.geeksforgeeks.org/javascript/backbone-js-sync-emulatejson/

⇱ Backbone.js Sync emulateJSON - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Backbone.js Sync emulateJSON

Last Updated : 23 Jul, 2025

Backbone.js is a compact library used to organize JavaScript code. An MVC/MV* framework is another term for it. If MVC is unfamiliar to you, it is just a technique for designing user interfaces. The creation of a program's user interface is made considerably easier by JavaScript functions. BackboneJS provides a variety of building elements to aid developers in creating client-side web applications, including models, views, events, routers, and collections.

Sync's emulateJSON is mainly used in the cases where the web server cannot handle encoded application/JSON requests. This method is mainly useful in the case of using a legacy web server. The activity of this method is to serialize the JSON under a model and process it as if it is an HTML form.

Syntax:

Backbone.emulateJSON=true

Example 1: The code below demonstrates syncing of a collection and how we can use the emulateJSON() method, so we can easily serialize the JSON under the model.

Output:

👁 Image
 

Example 2: The code below demonstrates syncing of a model and how we can use the emulateJSON() method so we can easily serialize the JSON under the model. 

Comment