Search code examples
xmlbackbone.jsmodel

How to convert my Backbone model to XML?


I want to produce an XML for every Backbone model that I create. I know that through Backbone.sync we can convert the models to xml and save them to the server. But I am only using local storage.


Solution

  • this is normal JSON to xml conversion, backbone has no much benefit in your case you can check this library https://github.com/alanclarke/node-json2xml

    it converts json object to xml, you can just call it passing model.attributes