Ghost/ghost/admin/app/transforms/json-string.js

12 lines
342 B
JavaScript
Raw Normal View History

import Transform from '@ember-data/serializer/transform';
export default Transform.extend({
deserialize(serialized) {
let _serialized = serialized === '' ? null : serialized;
return JSON.parse(_serialized);
},
serialize(deserialized) {
return deserialized ? JSON.stringify(deserialized) : null;
}
});