Skip to content

DataAPI SDK japanese MT.DataAPI Static method registerFormat

Taku AMANO edited this page Jul 5, 2013 · 4 revisions

registerFormat

Register formats that serialize data.

Parameters

Name Type Required Description
key String yes Format name
spec Object yes Format spec
spec.fileExtension String yes Extension
spec.mimeType String yes MIME type
spec.serialize String yes
spec.unserialize String yes

Example

DataAPI.registerFormat("json", {
  fileExtension: 'json',
  mimeType: 'application/json',
  serialize: function() {
      return JSON.stringify.apply(JSON, arguments);
  },
  unserialize: function() {
      return JSON.parse.apply(JSON, arguments);
  }
});

Clone this wiki locally