Robert Mosolgo

To my knowledge, batman.js is not maintained. For that reason, I don't suggest that you use it for a new project!

Sending JSON Instead of Form Data with Batman.RestStorage

By default, Batman.Request sends data as HTTP form data. However, you can override this with Batman.RestStorage.

Simply pass serializeAsForm: false to @persist in your model definition:

class MyApp.Model extends Batman.Model
  @persist Batman.RestStorage, serializeAsForm: false

Now, it will work with any JSON endpoint!

In my case, I was trying out batman.js and Martini, and I was surprised to find that RestStorage sends form data. I guess you never notice with Rails, since it puts everything into the params hash.